强制iframe加载全帧 [英] Force iframe to Load Full Frame
问题描述
我有一个HTML页面(称为welcome.html),其中包含一个iframe,我无法控制它(比如说app.html)。用户使用iframe中的应用程序执行一些操作,然后单击提交。一旦他们这样做,他们将被带到一个新的页面(称为thanks.jsp),该页面加载在iframe中。有一种方法,我可以强制thanks.jsp加载全帧,而不是iframe一旦提交被点击?请记住,我无法控制提交按钮或app.html背后的逻辑。不过,我确实可以控制welcome.html和thanks.jsp。如果可能的话,我想坚持使用HTML和/或JavaScript。提前感谢您。
您可能希望使用一个基础目标,以防万一它失败。 >
第一:
如果 然后: 包含framebuster JavaScript: 最后: 如果用户没有启用JavaScript,请确保它们不再留在框架中,然后他们必须: I have an HTML page (say welcome.html) which contains an iframe to a page I have no control over (say app.html). The user performs some actions using the app within the iframe and clicks submit. Once they do this, they are taken to a new page (say thanks.jsp), which loads within the iframe. Is there a way in which I can force thanks.jsp to load in the full frame and not the iframe once submit is clicked? Remember, I have no control over the logic behind that Submit button or app.html. I do however have control over welcome.html and thanks.jsp. If possible, I would like to stick with HTML and/or JavaScript. Thank you in advance. You probably want to use a framebuster, with a base target in case it fails. First: If Then: Include framebuster JavaScript: Finally: In case the user doesn't have JavaScript enabled, make sure they don't stay in the frame any longer then they have to:
这篇关于强制iframe加载全帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! thanks.jsp $ c
是通过一个post请求 - 重定向来请求的,所以它显示了该页面作为对get请求的响应。
< script type =text / javascript>
if(self!= top){top.location.replace(location); }
< / script>
< base target =_ top>
thanks.jsp
is requested via a post request - redirect so it you present the page as the response to a get request.<script type="text/javascript">
if (self != top) { top.location.replace(location); }
</script>
<base target="_top">