Click here to Skip to main content
16,004,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to modify the URL (query string parameter) and redirect to same page in javascript(In button click event).
I have tried
1.window.location.href = finalURL;
2.window.location.replace(finalURL);
3.$(location).attr('href', finalURL);
4.window.open(finalURL, '_self');
It work in Firefox, but nothing work in case of IE9,Chrome.
In IE9,Chrome the page is post back but the new URL with modify Query string parameters is not reflecting.Is there any solutions which work for IE and Chrome ?

Thanks in advance.
Posted

hi
Please Try This Code
JavaScript
location.assign('YourUrl');
 
Share this answer
 
v3
Comments
r.b.satpathy 20-Jun-12 5:25am    
Hi Akash,
location.assign() is also not working.
window.location = newUrl;


HTML
<html>
<head>
</head>
<body>
	<input type="button" value="Visit thread" onclick="window.location = 'http://www.codeproject.com/Questions/407140/location-href-is-not-working-in-IE9-and-Chrome';"/>
</body>
</html>
 
Share this answer
 

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