Results 1 to 2 of 2

Thread: Redirect to iFrame

  1. #1
    Join Date
    Jul 2009
    Location
    Washington (USA)
    Posts
    94
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Question Redirect to iFrame

    Hi

    I'm currently using the following script to redirect my visitors. my site uses an iFrame and i don't want them to see the pages it contains except through it. this script redirects them if they're not viewing the page in an iFrame.

    Code:
    if (parent.frames.length != 0) {
      // loaded in frames
    }
    else {
      // not loaded frames
    window.location.href = 'http://www.mydomain.com/'
    }
    This works nice and all, but i'd like it to redirect the users to a unique page depending on they're original request. any ideas???

  2. #2
    Join Date
    Jul 2009
    Location
    Washington (USA)
    Posts
    94
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Default

    never mind, i made a solution:

    Code:
    var url = window.location.href;
    var page = url.split("http://www.mydomain.com");
    
    if (parent.frames.length != 0) {
      // loaded in frames
    }
    else {
      // not loaded frames
    window.location.href = 'http://www.mydomain.com/?fs=' + page[1] +''
    }

Bookmarks

Posting Permissions

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