0

Ok I am wanting to replace a popup URL with another URL, in my case the same link, with setTimeout but I do not know how to do this. So far I have gotten this code.....

<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>

In connection with....

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

The issue is it does not work. I have tried a few different ways of doing this but I do not know what I am doing wrong.

  • 1
    your code makes no sense. it's not even valid js – Kirill Ivlev Aug 07 '13 at 22:40
  • Are you trying to open https://gamessl.ageofchampions.com/... in a popup, and then run some javascript on that page? Sounds like XSS will stop you. – Jim W Aug 07 '13 at 22:43
  • I know it is not valid javascript as it does not work but I do not know where I am going wrong with it. That is why I am here, to get help. @JimW That is a possible issue I might run into but I would like to know how to properly open a popup then replace the URL with a bookmarklet. If anyone can help I would greatly appreciate it. – William Girona Aug 07 '13 at 22:56
  • why do you keep opening new questions for the same thing – gezzuzz Aug 08 '13 at 15:10

1 Answers1

0

Try reusing the window instance like this:

var foo = window.open('http://www.google.com', 'bar');
foo.open('http://www.bing.com', 'bar');
Lord Midi
  • 754
  • 1
  • 9
  • 25