SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE6 and the blasted window.location bug

    Hey guys.

    I've tried searching the web on this issue and it seems that other people have had the same issue, but nothing has helped them solve it.

    So I'm building a history manager that uses a #/ url prefix to manage page to page browsing entirely in ajax (like how facebook does it).

    For IE6 and IE7 I use an empty frame to capture the hash history change (since both browsers do not create a history entry for the #any-new-hash-change-value). I've gotten everything to work, for all the other high-end browsers and IE7, but IE6 has this annoying bug that won't allow it to change the URL of the page.

    Basically, when the back button is pressed, the frame then goes to a previous state which then fires off a function that tells it to change the browser's address bar string. I know that the page changes because when I click refresh, the address bar changes to what it should be.

    Any idea what this is? I've tried:

    -location = '...';
    -location.href = '...';
    -window.location = '...';
    -window.location.href = '...';
    -document.location = '...';
    -document.location.href = '...';

    Remember, this is only an IE6 bug. It works perfectly fine in IE7.

    One more thing, I'm using a collection of IE browsers for windows. Could this be a software level bug?
    I can't believe I ate the whole thing

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried setting the location's hash directly? -

    Code JavaScript:
    iframe.contentWindow.location.hash = 'something';
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not trying to replace the iframe window src.

    I'm trying to make the iframe change the src of the parent window. Since the IFrame has now loaded something new (the back button event) and it now has to change the URL of the browser address bar (the parent window).

    So we have

    Code:
    $('iframe').addEvent('load',function() {
    
    var url = new String($('iframe').contentWindow.location);
    
    //set the new hash upon it
    
    window.location = url; //the new hash has been applied
    
    });
    Yes I have also tried.

    window.location.hash = newHash;
    I can't believe I ate the whole thing

  4. #4
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK I figured it out.

    There was no problem with the script.

    The problem was that I was manually changing the URL (in the address bar) which was causing IE6 to prevent any future changes to it.

    So I added a couple of links to the page and tested the back/forward buttons and it works perfectly.
    I can't believe I ate the whole thing


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
  •