javascript - How to store user input urls (anchor links) and redirect user using window.location? -


i managed create condition detect anchor link, after how store anchor link in anchor_num variable, can redirect use specific url?

<script type="text/javascript">  $(function(){      if(window.location.hash){          var anchor_num = "anchorstring";         window.location = "#"+ anchor_num;      } else            {             //redirect default page           } });  </script> 

by appending or changing hash browser wouldn't refresh page. should call window.location.reload() after you've set hash:

window.location = "#"+ anchor_num; window.location.reload() 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -