Is it possible to redirect HTML to javascript function? -
i have following html code :
<div class="action-button"> <a href="/wp-login.php?loginfacebook=1&redirect=http://blabla.com" class="mybutton">hello </a> </div>
is possible call javascript function (stored in file) while redirecting instead of redirecting specific url ?
the javascript file in same domain rest.
thank you.
you can query string. example
<a href="http://blabla.com/mypage.html?callfunction=1">hello</a>
then on page redirects (mypage.html) you'd like
<script> if (getparameterbyname('callfunction') == 1) callmyfunction1(); </script>
you pass parameters via querystrings.
for more info on querystrings see-- how can query string values in javascript?
function getparameterbyname(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); }
Comments
Post a Comment