HTML after ignoring iframe

Currently, I am facing a problem that is very similar to this first-hand, however solving this problem in my case did not help.

I have a tagx in which I have an iframe in which I set the src attribute using jQuery to a specific value depending on the hyperlink. The tag is embedded in a jspx file, mainly consisting of a spring form. Everything works well, except that the code written directly under the iframe is not displayed by the browser (tested in Firefox and Chrome, not sure about other browsers). Even code written in jspx directly below the tag (which inserts the tag with iframe) is not displayed.

containerCreator.jspx:

<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:form="http://www.springframework.org/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:roo="urn:jsptagdir:/WEB-INF/tags" xmlns:olo_elem="urn:jsptagdir:/WEB-INF/tags/olo/admin/element" xmlns:spring="http://www.springframework.org/tags" id="elementen_base" version="2.0"> <spring:url value="/admin/element/saveContainerElementBean" var="save"/> <form:form action="${save}" method="POST" modelAttribute="containerElementBean"> <input type="submit" value="sla op"/> <olo_elem:containerCreator path="${path}" containerId="${id}"/> <p>I'm not visible</p> </form:form> </div> 

containerCreator.tagx:

 <jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:form="http://www.springframework.org/tags/form" xmlns:olo_elem="urn:jsptagdir:/WEB-INF/tags/olo/admin/element" xmlns:spring="http://www.springframework.org/tags" version="2.0"> <jsp:directive.attribute name="containerId" type="java.lang.Long" required="false" description="id van de container die wordt bevat, null indien nog geen container is gebonden" /> <jsp:directive.attribute name="path" type="java.lang.String" required="false" description="pad waarin het id van een nieuw containerelement wordt gezet"/> <spring:url value="/admin/element/editContainer/${containerId}" var="existingLink" /> <spring:url value="/admin/element/newContainer" var="newLink" /> <script type="text/javascript"> function openExisting(){ $('#editor').attr('src', '${existingLink}'); $("#editor").show(); } function openNew(){ $('#editor').attr('src', '${newLink}'); $("#editor").show(); } $(document).ready(function(){ $("#editor").hide(); }); </script> <c:choose> <c:when test="${not empty id}"> <a onclick="javascript: openExisting()">Bewerk ContainerElement</a> </c:when> <c:otherwise> <c:choose> <c:when test="${not empty path}"> <input type="hidden" name="${path}" id="path" value=""/> <a onclick="javascript: openNew()">Maak ContainerElement</a> </c:when> <c:otherwise> Error: Geef containerId of tag op! </c:otherwise> </c:choose> </c:otherwise> </c:choose> <iframe id="editor" style='width: 800px; height: 800px' name="iframeId" frameborder="0"> </iframe> <p>I'm not visible</p> </jsp:root> 
+4
source share
3 answers

What you need to do is insert a comment between iframe tags. Some browsers do not allow empty tags. Inserting a comment in these tags will probably fix your problem. See the example below:

  <iframe id="editor" style='width: 800px; height: 800px' name="iframeId" frameborder="0"><!-- //required for browser compatibility --></iframe> <p>I am visible!</p> </jsp:root> 
+5
source

This happened to me with embedding youtube in <!doctype html> dom.

 <iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=http://example.com" frameborder="0"/> 

The trick was to add a closing </iframe> , not a self-closing tag:

 <iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=http://example.com" frameborder="0"></iframe> 
0
source

Add text inside iframe. He will work.

 <iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=http://example.com" frameborder="0">some text</iframe> 
0
source

All Articles