-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix cross origin check for ie #531
base: master
Are you sure you want to change the base?
Conversation
in ie sometimes the link.protocol and link.hostname attributes are not set correctly, parse the href manually
Thanks for reporting. If the /cc @mastahyeti |
I Can remember that jQuery also uses this "hack" to work around ie limitations, but cannot find the issue/ticket right now. |
Unfortunately I cannot provide you with an example. The problem occured on some links in our application, which were dynamically generated. The re-parse then happens on a newly created link, this fixed the issue in our case. |
Without a test case to reproduce it with, I can't merge this yet. |
just found the jquery issue/ticket which I was refereing to above: this ticket was about simplifying their URL parsing... they didn't change it because of x-browser issues. |
Yep, this sounds rights. IE returns empty hostname and protocol for anchor tags whose href is a relative path, but setting |
Oh it's an IE thing? I will check, thanks |
Just experienced this issue (IE only) and the fix in the PR solved it for us. It was happening when loading in content dynamically via AJAX and then changing the href of the new DOM elements. There's probably a simpler repro use case, but that was ours. |
Reproduced in IE11 for generated link like this: $('<a/>', {href: '/path/...'}) Debugger shows empty protocol and hostname. |
IE11 var a = document.createElement('a');
a.href = '/path';
// "", "", "http://host/path"
console.log(a.protocol, a.hostname, a.href);
a.href = a.href;
// "http:", "host", "http://host/path"
console.log(a.protocol, a.hostname, a.href); |
+1 I have had this issue with a widget where links are exchanged dynamically. After the href has been exchanged, a click on this link does a full reload of the page under IE11. The changes of this pull request fixes that issue. |
in ie sometimes the link.protocol and link.hostname attributes are not set correctly, parse the href manually