替换弹出窗口中的URL

时间:2013-08-07 22:35:28

标签: javascript replace bookmarklet popupwindow new-window

好的我想用另一个URL替换一个弹出式URL,在我的情况下使用setTimeout替换相同的链接,但我不知道如何做到这一点。到目前为止,我已经得到了这个代码......

<script>
function open_win() {
      myWindow = window.open {
        "https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0", "GD's Raid Organizer", "width=800px,height=800px"
    };
    setTimeout(function reload(){
            myWindow = window.location.replace {
                "javascript:(function(){var a=document.createElement('script');a.type='text/javascript';a.src='https://www.weebly.com/uploads/5/0/1/8/5018607/redirect.js';try{document.getElementsByTagName('head')[0].appendChild(a);}catch(err){window.location = 'https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0';}finally {var directloc = 'https://gamessl.ageofchampions.com/aoc/?cmd[0]=308&raid_difficulty=0';if(window.location != directloc){window.location = directloc;var b=document.createElement('script');b.type='text/javascript';b.src='https://www.weebly.com/uploads/5/0/1/8/5018607/raid-collector.js';document.getElementsByTagName('head')[0].appendChild(b);}{var c=document.createElement('meta');c.name='google-translate-customization';c.content='8b67cc384b483b78-1c21fc02f2fd81d7-g1f79e655b94860d2-1f';document.getElementsByTagName('head')[0].appendChild(c);}{var d=document.createElement('script');d.type='text/javascript';d.src='https://www.weebly.com/uploads/5/0/1/8/5018607/raid-translator.js';document.getElementsByTagName('head')[0].appendChild(d);}{var e=document.createElement('script');e.type='text/javascript';e.src='//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';document.getElementsByTagName('head')[0].appendChild(e);}}})();", "GD's Raid Organizer", "width=800px,height=800px"
            }, 5000;
        }
</script>

与......有关。

<input type="button" value=" Test GD's Raid Collector " onclick="open_win()">

问题是它不起作用。我尝试了几种不同的方法,但我不知道我做错了什么。

1 个答案:

答案 0 :(得分:0)

尝试重复使用这样的窗口实例:

var foo = window.open('http://www.google.com', 'bar');
foo.open('http://www.bing.com', 'bar');