From a6a6888ec9199a67ba489c853d1db1c32b3e6e2e Mon Sep 17 00:00:00 2001 From: tbuechner Date: Sun, 31 May 2015 14:34:36 +0200 Subject: [PATCH] fix cross origin check for ie in ie sometimes the link.protocol and link.hostname attributes are not set correctly, parse the href manually --- jquery.pjax.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jquery.pjax.js b/jquery.pjax.js index f1728d45..d4fd5a3d 100644 --- a/jquery.pjax.js +++ b/jquery.pjax.js @@ -71,8 +71,13 @@ function handleClick(event, container, options) { if ( event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey ) return + var parser = document.createElement('a') + parser.href = link.href; + var linkHostname = parser.hostname + var linkProtocol = parser.protocol + // Ignore cross origin links - if ( location.protocol !== link.protocol || location.hostname !== link.hostname ) + if ( location.protocol !== linkProtocol || location.hostname !== linkHostname ) return // Ignore case when a hash is being tacked on the current URL