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

    JS Redirect Not Working for IE

    I have data pages in my e-commerce site (from 1999) that are imbedded in a parent page using the object tag. I have started to include a little JS snippet that is intended to redirect to the parent if the embedded pages are loaded separately:

    Code:
    <script language="JavaScript" type="text/javascript">
    try { if (top == self) {top.location.href='parentpage.htm'; } } catch(er) { }
    </script>
    This works fine in Firefox, but in IE 7 and 8 it gets into an infinite loop of reloading the parent page into the object frame.

    Here is a sample:
    http://www.greathallminis.com/Ancien...s_anc15_mm.htm

    (I've left this page with the issue, while I have excluded the script for IE elsewhere.)

    Is there an alternative and equally simple script for IE, or can I modify this to work for IE?

    Thanks,

    Rob

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    878
    Thanks
    0
    Thanked 114 Times in 113 Posts
    <script language="JavaScript" type="text/javascript">
    if (location.href == top.location.href) {top.location.href='parentpage.htm';}
    </script>

  • #3
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by lerura View Post
    <script language="JavaScript" type="text/javascript">
    if (location.href == top.location.href) {top.location.href='parentpage.htm';}
    </script>
    Hi!

    Thanks for the try, Lerura, but that still seems to do the same thing. I have your script installed on:

    http://www.greathallminis.com/Ancien...s_anc15_mm.htm

    For IE8 it is still doing the infinite loop into the object.

  • #4
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah, well. On to another forum, I guess.


  •  

    Posting Permissions

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