gpt4 book ai didi

asp.net - 加载前跳出框架页面

转载 作者:行者123 更新时间:2023-11-30 10:56:02 25 4
gpt4 key购买 nike

我有一个框架内的 aspx 页面。我想重定向到一个新页面,但在该页面加载之前,跳出框架。我正在使用这个js代码

window.onload = TimeOutRedirect;
function TimeOutRedirect()
{
try
{
if (self.parent.frames.length != 0)
self.parent.location=document.location;
}
catch (Exception) {}
}

这有效,但它会等到页面加载,这样您就可以在页面出现之前在框架中看到该页面。

我尝试使用另一个页面作为中间人,但我无法在页面加载后重定向。

最佳答案

请参阅 Jeff 在 http://www.codinghorror.com/blog/archives/001277.html 上的帖子

基本上,您可以尝试破坏他们的框架……他们可以尝试破坏您的框架破坏代码。这实际上取决于制定者的决心。

引用:

What's really scary is that near as I can tell, there is no solution. Due to cross-domain JavaScript security restrictions, it is almost impossible for the framed site to block or interfere with the parent page's evil JavaScript that is intentionally and aggressively blocking the framebusting.

If an evil website decides it's going to frame your website, you will be framed. Period. Frame-busting is nothing more than a false sense of security; it doesn't work.

关于asp.net - 加载前跳出框架页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1557041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com