How can I run this JavaScript snippet only once when a user logs in? -
i have simple javascript snippet.
<script> window.onload = function(){ swal("hello!", "welcome portal", "success"); }; </script>
how can run if page url http://portal/?init
i.e. not run when page url http://portal
or http://portal/?something_else
?
check location.search
of page.
<script type="text/javascript"> if(location.search == "?init"){ window.onload = function(){ swal("hello!", "welcome portal", "success"); }; } </script>
Comments
Post a Comment