javascript - Window.open not running -


so know it's more me mistyping something, or incorrectly using bit of code copied, can't open new page or display alert.

there 2 main parts code, 1 part takes query ids whatever got linked page on , sets passed onto next page. second part attempts open page automatically, , if gets blocked popup blocker asks user turn off popup blocking on page.

it correctly pass query id through. have manual link fallback on page is, prefer user automatically have page @ least attempt open them.

(function() {      function qsubids(){          querystring = location.search ? location.search : '';          if (querystring.charat(0) == '?') querystring = querystring.substring(1);          if (querystring.length > 0){              querystring = querystring.replace(/\+/g, ' ');              var querycomponents = querystring.split(/[&;]/g);              (var index = 0; index < querycomponents.length; index ++){                  var keyvaluepair = querycomponents[index].split('=');                 var key          = decodeuricomponent(keyvaluepair[0]);                 var value        = keyvaluepair.length > 1                                ? decodeuricomponent(keyvaluepair[1])                                : '';                  this[key] = value;              }          }      }      var qsubids = new qsubids();      settimeout(function(){         var doc       = document.documentelement;         doc.innerhtml = doc.innerhtml.replace(/(\[|\%5b)s1(\]|\%5d)/ig, qsubids.s1);         doc.innerhtml = doc.innerhtml.replace(/(\[|\%5b)s2(\]|\%5d)/ig, qsubids.s2);         doc.innerhtml = doc.innerhtml.replace(/(\[|\%5b)s3(\]|\%5d)/ig, qsubids.s3);         doc.innerhtml = doc.innerhtml.replace(/(\[|\%5b)s4(\]|\%5d)/ig, qsubids.s4);         doc.innerhtml = doc.innerhtml.replace(/(\[|\%5b)s5(\]|\%5d)/ig, qsubids.s5);     }, 0);  })(); 

that first part functions fine simple part won't run @ seems

var win = window.open('https://www.google.com' + qsubids.s1); if (win) {     //browser has allowed opened     win.focus(); } else {     //browser has blocked     alert("please allow popups website"); } 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -