samedi 22 juillet 2017

covering query string variations of a window.location.href

Consider the following JS code:

if ( window.location.href == "http://ift.tt/1iEqFPv" ) {
    // do stuff...
}

I need that the comparison operator will not only cover the exact URL, but also any possible variation of it with query strings and data coming after the phrase "signin".

How will you do that in JS? I know it should include regex but as linear learning is important for me, I would prefer waiting to my course on JS regex in the coming weeks and just ask here, in this special occasion.

Aucun commentaire:

Enregistrer un commentaire