[js-embedded-discovery] branch master updated: EDS-75 Dispatch auto-select with an <a href="">
Rod Widdowson
rdw at steadingsoftware.com
Mon Jan 23 05:18:19 EST 2017
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository js-embedded-discovery.
View the commit online:
http://git.shibboleth.net/view/?p=js-embedded-discovery.git;a=commit;h=fa6ea956b173817706a1fde0150b65d21cd9853c
The following commit(s) were added to refs/heads/master by this push:
new fa6ea95 EDS-75 Dispatch auto-select with an <a href="">
fa6ea95 is described below
commit fa6ea956b173817706a1fde0150b65d21cd9853c
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jan 23 09:18:46 2017 +0000
EDS-75 Dispatch auto-select with an <a href="">
https://issues.shibboleth.net/jira/browse/EDS-75
location.href=<address> causes (at least) Firefox to sent a 302 and
appears that Firefox then caches this. Opinions differ as to whether
it is within it's right but "it is what it is".
The checkin stops using this technique and instead builds an <a>, adds
it to the page and then clicks it. This causes (at least firefox to
send) a GET to the address and is what the "previously used icons"
thing does as well - and this has never been seen to cache.
---
src/javascript/idpselect.js | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/javascript/idpselect.js b/src/javascript/idpselect.js
index cc5dc9e..6f355a4 100644
--- a/src/javascript/idpselect.js
+++ b/src/javascript/idpselect.js
@@ -82,6 +82,12 @@ function IdPSelectUI() {
return;
}
+ idpSelectDiv = document.getElementById(parms.insertAtDiv);
+ if(!idpSelectDiv){
+ fatal(getLocalizedMessage('fatal.divMissing'));
+ return;
+ }
+
//
// Quick test for auto-dispatch
//
@@ -101,17 +107,11 @@ function IdPSelectUI() {
//
// Go there
//
- location.href = returnString + retString;
+ dispatchTo(idpSelectDiv, returnString + retString);
return;
}
}
- idpSelectDiv = document.getElementById(parms.insertAtDiv);
- if(!idpSelectDiv){
- fatal(getLocalizedMessage('fatal.divMissing'));
- return;
- }
-
if (!load(parms.dataSource)) {
return;
}
@@ -343,11 +343,12 @@ function IdPSelectUI() {
//
if (isPassive) {
var prefs = retrieveUserSelectedIdPs();
+ var parentDiv = document.getElementById(parmsSupplied.insertAtDiv);
if (prefs.length == 0) {
//
// no preference, go back
//
- location.href = returnString;
+ dispatchTo(parentDiv, returnString);
return false;
} else {
var retString = returnIDParam + '=' + encodeURIComponent(prefs[0]);
@@ -359,7 +360,8 @@ function IdPSelectUI() {
} else {
retString = '&' + retString;
}
- location.href = returnString + retString;
+
+ dispatchTo(parentDiv, returnString + retString);
return false;
}
}
@@ -458,6 +460,20 @@ function IdPSelectUI() {
return (browserName == 'Microsoft Internet Explorer') ;
} ;
+ /**
+ * Alternative to location.href=string
+ *
+ * Needed to cache bust Firefox
+ */
+
+ var dispatchTo = function(theParent, whereTo) {
+ var aval = document.createElement('a');
+
+ aval.href = whereTo;
+ theParent.appendChild(aval);
+
+ aval.click();
+ }
/**
Loads the data used by the IdP selection UI. Data is loaded
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list