Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a situation where I need to change the URL of page on click of Button & perform the Execution of code for the Click event of that Button. I don't want to redirect the page, as I am using the Update panel & want to remain on the same page & change the URL.

I want to know is it possible. As I have came to know about :

C#
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");



But it's working on latest browsers & not all browsers.


Thanks

TusDev1
Posted
Comments
ZurdoDev 21-Jun-12 8:04am    
I am not familiar with any way to do this. Changing the URL means you are going to a different page. So, wanting to change it but not change pages does not make sense. Is the URL actually the same page and you are just adding a querystring option? I think you need to relook at how you are doing things.

1 solution

It's true that pushing into the history is not supported on all browsers.
Would using the location.hash help you?
example.com/foo#bar
example.com/foo#baz
This changes the url without reloading the whole page.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900