Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Thanked 0 Times in 0 Posts

    Javascript Redirect - Please Read, Complicated Task

    Hello, ok here is the scenereo I have created a popup to load an offsite game into it. And when they register to play the game it loads there homepage, which is fine but what I need to do is for it to redirect them back to the origonal popup. Let me give you some links so you can test it for yourself so you get a better understanding

    click on the big graphic titled Adventure Quest, it will open in a popup window

    Now when you goto register to play the game
    (please test this its free registration) it takes you to there homepage after you go through the registration process you can even enter false information it dont matter. This all still done inside the popup window on my site.

    It takes you to there homepage which is http://www.battleon.com what I am trying to do is I thought If i added an iframe with like 1 width and height and placed a code in there that was something like:

    if load"http://www.battleon.com"
    redirect to http://infernozard.battleon.com/build30/game.asp

    and this would only trigger from the iframe if the page thats in the popup is http://www.battleon.com

    Thank you in advance for any help on this matter
    Last edited by antimedia; 10-15-2005 at 10:35 AM.

  2. #2
    New Coder
    Join Date
    Oct 2005
    Thanked 0 Times in 0 Posts
    This is just a thought. I have no idea if it would work.

    Create a new html page that would open in the popup when you clicked the game link. Inside that page create an iframe and have the external site load in that iframe. You could get away with using a width and height of 100% for the iframe since you don't really need the space for anything else. Then add the code below to the page that contains the iframe.
    //top frame
    parent.frames[1].document.onload = function() {
         if (parent.frames[1].document.location.href == "http://externalsite.com") {
              window.location.href = "http://yoursite.com";
    That should check the frame url everytime it loads a new page. If it finds a match then it redirects back to your page. You may have to tweak it a bit, such as changing the frames[] index number or adding the parent.frames[] to the window.location. But I'm pretty sure it should work.

    If it doesn't work, you may have to use the old fashion way for creating frames. Create a page containing a frameset tag and name each frame src. Then create a separate file for the first frame src that includes the function listed above. And set the src of the second frame to the external site url.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts