I want to show alert when the new tab open is match on the URL I want..
I came up with this code..
<button class="button" id="open-newtab"
onclick="return ouvre('http://ift.tt/g8FRpY');">Open</button>
<script>
function ouvre(fichier) {
ff = window.open(fichier, "popup", "width=600px,height=300px,left=50%,top=50%");
if (ff.location.href.match(/https:\/\/www.facebook.com/)) {
alert("Hello! I am an alert box!!");
}
}
</script>
when I removed the ff on ff.location.href.match it will read the current url of the window not the new tab..
Is it possible to read the location.href of the new tab?
Thank you
Aucun commentaire:
Enregistrer un commentaire