Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在访问时添加Iframe当前域?_Javascript_Jquery_Dns_Url Redirection_Http Redirect - Fatal编程技术网

Javascript 如何在访问时添加Iframe当前域?

Javascript 如何在访问时添加Iframe当前域?,javascript,jquery,dns,url-redirection,http-redirect,Javascript,Jquery,Dns,Url Redirection,Http Redirect,听着,这是主站点链接>>http://magazinerpros.blogspot.com/ 现在我想知道如果有人点击上面的链接。然后它也应该打开以保持另一个链接。就像你在例子2中看到的。包含额外帧链接{http://www.inframe.com/p/preview.html?}在主链接之前 示例#2 我试图在我的测试站点上添加脚本,但当访问它时,它会不断加载 我在下面的站点中添加的脚本 <script type="text/javascript"> window.locatio

听着,这是主站点链接>>
http://magazinerpros.blogspot.com/

现在我想知道如果有人点击上面的链接。然后它也应该打开以保持另一个链接。就像你在例子2中看到的。包含额外帧链接{
http://www.inframe.com/p/preview.html?
}在主链接之前

示例#2

我试图在我的测试站点上添加脚本,但当访问它时,它会不断加载

我在下面的站点中添加的脚本

<script type="text/javascript">
window.location.replace("http://www.iframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");
</script>

window.location.replace(“http://www.iframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");


所以请只给我javascript或jequery脚本。使此重定向成为可能。您可以在示例2中看到。那么我应该在站点中添加什么脚本呢。因此,在访问后,它会在地址栏中保留它前面的另一个帧链接。

看起来您正在创建重定向循环

检查URL,如:

<script type="text/javascript">
if (window.location !== "http://redirectssite.blogspot.com/") {
    window.location.replace("http://www.iframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");
}
</script>

如果(window.location!==”http://redirectssite.blogspot.com/") {
window.location.replace(“http://www.iframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");
}
根据下面的脚本,它可以正常工作

<script type="text/javascript">
if ( !(window.location !== window.parent.location) ) {
    window.location.replace("http://www.inframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");
}
</script>

if(!(window.location!==window.parent.location)){
window.location.replace(“http://www.inframe.com/p/preview.html?url=http://redirectssite.blogspot.com/");
}

谢谢bundles@bobdye,第二个对我有用。。。我在这里添加了第一个脚本,但没有处理它的重载。但是当我在另一个测试站点中添加第二个脚本时。它起了很大的作用。再说一次,我希望你是最好的,我一直在寻找问题,但没有人来帮助我。但你解决了我的问题。谢谢你。祝你长寿。