mercredi 5 avril 2017

Link redirecting assistance

Here's the script:

<script>
if(document.location.href.indexOf('http://ift.tt/2oCNYS7') > -1) { 
document.location.href = 'http://ift.tt/2oJActo';
}
</script>

Question is, how can i make the code so that when i put https://thedomain.com/////////////////////////////////////////collections/all?sort_by=best-selling

How to incorporate var correctURL= document.location.href.replace(/([^:]/)/+/g, "$1"); whenever i duplicate any of the "/" "?" "_" "=" "-" characters in the web link.

Bottom line is i don't want to be forced to do this (its inefficient):

<script>
if(document.location.href.indexOf('https://thedomain.com/////////////////////////////////////////collections/all?sort_by=best-selling') > -1) { 
document.location.href = 'http://ift.tt/2oJActo';
}
</script>

Aucun commentaire:

Enregistrer un commentaire