Reload page with another anchor.

Just stuck in one problem. I have a jQuery UI tabbed page. Each tab can be accessed from another page by adding a hash tag to the link and loading the page with the desired tab. However, I also need to access the various tabs on the same page. I came up with to add the target = "_ parent" link to the link with the hash tag:

<a href="pictures.htm#tab2" target="_parent"> 

and it does what I need, but only in IE. It reloads the page with a different hash tag, but for some reason Chrome and Firefox load the same tab every time. I need to create a javascript function for a link that will completely reload the page with another hash tag .

I came up with this code:

 function gototab(reload) { window.location.href = 'pictures.htm#tab2'; window.location.reload(true); } <a href="pictures.htm#tab2" onclick="gototab();">open tab 2</a> 

It seems to me that I almost closed it, but something is wrong with my script. Can someone help me solve this problem?

Thanks!

+4
source share
1 answer

You can do it:

 function gototab(reload) { window.location.hash = '#tab2'; window.location.reload(true); } <a href="pictures.htm#tab2" onclick="gototab();">open tab 2</a> 
+12
source

All Articles