arielsalminen / TinyNav.js

Responsive navigation plugin that weighs just 443 bytes
http://tinynav.viljamis.com/
635 stars 207 forks source link

IE Bug with relative URLs #41

Open untervolldampf opened 11 years ago

untervolldampf commented 11 years ago

In IE (9/10) baseURL is ignored, so when the option value is "page1/page2", and the current page is "http://example.com/page1/page3", IE tries to load "http://example.com/page1/page3/page1/page2"

Line 59 should be changed to reflect relative URls and IE9 behaviour, e.g.

var callURL = $(this).val(); if ($.browser.msie && callURL.indexOf("//") == -1 ) { callURL = "/" + callURL; }

Thx!

KelvinC013 commented 11 years ago

Having same problem with IE10. Is this code "replacing" what's on line 59? ie..replace this function..

// Change window location $select.change(function () { window.location.href = $(this).val(); });

Thanks

untervolldampf commented 11 years ago

Yap, i replaced it with the following quick workaround which solved the problem for me:

    // Change window location
    $select.change(function () {            
      var callURL = $(this).val();
      if ($.browser.msie && callURL.indexOf("//") == -1 ) {
          callURL = "/" + callURL;
      }
      window.location.href = callURL; 
    });