iframe

iframe 中 srcdoc 和 contentWindow.postMessage 的坑

左心房为你撑大大i 提交于 2019-12-30 21:43:39
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 使用 iframe.srcdoc 后,iframe 的域名和路径变成奇怪 srcdoc 。因为没有域名和路径,也就无法找到相对地址的资源。当然绝对地址资源不会受到这种影响. 必须在 iframe 加载到一定阶段后才能使用 iframe.contentWindow.postMessage() 与 iframe 进行通信,否则通信失败。 稳妥起见,用 iframe.addEventListener("load", e => console.log(e), {once:true}) 来确认iframe 是否加载完成。 来源: oschina 链接: https://my.oschina.net/reter/blog/3151118

Server-side detection that a page is shown inside an IFrame

我的未来我决定 提交于 2019-12-30 19:29:00
问题 Is it possible to determine - server-side - whether a page has been loaded within an IFrame ? When certain errors happen in my application the user gets redirected to Default.aspx and an error message is shown. The text of that error message gets set in session by exception handling code. The error message gets cleared from session once it has been shown. However, part of my application has to use an IFrame (it's doing a 3D Secure card payment check, which mandates an IFrame in order to

How can I detect when an iFrame goes fullscreen?

佐手、 提交于 2019-12-30 18:54:19
问题 I have a document that is embedded in my site by using an iFrame. The iFrame is from Box.com document viewer. The iFrame has its own built in fullscreen button. The fullscreen button is within the iFrame so I cannot attach a click event listener to the button. I added the attribute allowfullscreen to the iFrame to allow it to go fullscreen. I want to do something like this: $('iframe').on 'EnterFullScreen', () -> # Run function But what event do I have to listen to, to detect when the iFrame

Why usage of any a4j element in jsf add to page code second body and head tags?

爱⌒轻易说出口 提交于 2019-12-30 10:45:34
问题 In my jsf page code I have a structure similiar to this one : <frameset id="navframeset"> <frame name="navframe" src='<c:url value="TopNavigation.jsf"/>'/> <frameset> <frame name="leftframe" src='<c:url value="Test1.jsf"/>'/> <frame name="tabbedframe" src='<c:url value="Test2.jsf"/>' /> </frameset> In Test2.jsf i included following richfaces libraries : <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> When I try to use any of

CKEditor loses content when removed from DOM and added again

佐手、 提交于 2019-12-30 10:18:47
问题 Context CKEditor is a rich text editor that uses an iframe with an editable body. I have a situation where I need to temporarily remove an element containing a CKEditor instance from my page, then add it back some arbitrary amount of time later. Problem Unfortunately, this seems to cause the iframe to reset. Where the editor originally contained the rich text content and an editable body element, after adding the editor back to the page the iframe body is empty and no longer editable.

Using a time-based, rotating hash or string for security

南楼画角 提交于 2019-12-30 09:35:33
问题 In a CMS app I occasionally need to open an iframe of another domain. At the moment I am setting the URL for that iframe to something very obscure. Like http://domain.com/iframe/jhghjg34787386/. This works but theoretically that iframe source url will get saved in the user's history and could be accessed from the outside world. So, I am wondering about using a time-based approach to an ever-changing hash or string that is processed on the request side and is checked on the iframe source side.

Getting iframe current src url in cross domain [duplicate]

微笑、不失礼 提交于 2019-12-30 08:49:31
问题 This question already has answers here : How do I get the current location of an iframe? (9 answers) Closed 2 years ago . I have an iframe in my web app and I need to get its current url from the parent document (also when the user navigates the frame and change the original source url). Url is needed simply to social share it. As a cross-domain scenario, I don't own the child document (its a remote domain). I am aware of the same-origin-policy that prevents cross domain access from parent

Disable Cookies Inside A Frame/Iframe

我们两清 提交于 2019-12-30 08:41:15
问题 Is there any way to programatically disable cookies being created by a page displayed inside of a frame/iframe? Or to generalise further, is it possible to programatically disable javascript running on such a page? Thanks, DLiKS 回答1: with iframe sandbox attribute (html5) it will be possible (implemented in chrome) http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox NullUserException already answered what you can do today without browser support 回答2: The only way you could change

Google Chrome Won't Accept .contentDocument or .contentWindow!

核能气质少年 提交于 2019-12-30 07:16:09
问题 When I try my code out: Testing.html - <script language="JavaScript" type="text/javascript"> function find() { var iframeEl = document.getElementById('love'); if ( iframeEl.contentDocument ) { var form = iframeEl.contentDocument.document.getElementById('hi').getAttribute('href'); alert(form) } else if ( iframeEl.contentWindow ) { var form = iframeEl.contentWindow.document.getElementById('hi').getAttribute('href'); alert(form) } } </script> <body onload="find()"> <iframe name="lovez" src=

prevent page opening on an iframe?

拟墨画扇 提交于 2019-12-30 07:14:08
问题 How can I prevent page opening on an iframe using PHP? Like Gmail inside an iframe? 回答1: For PHP, you can use. header("X-FRAME-OPTIONS: DENY"); This is only supported in modern browsers, IE8+, Firefox 3.6.9, Safari 4 and Chrome. For older browser, you would also require some JavaScript. 回答2: You can do that with JavaScript if( (self.parent && !(self.parent===self)) &&(self.parent.frames.length!=0)){ self.parent.location=document.location } This will redirect from page that opens your page in