0

I want to update browser url without page being submitted.The URL can be anything, like xyz..Please help me.Thanks in advance.

This is what i have done so far.

if (history.pushState)
{                    
    window.history.pushState({ "html": response.html, "pageTitle": response.pageTitle }, "", urlPath);
}
else
{
    window.location.pathname = urlPath;                            
}

But the page reloads by using this. Why ? can anyone help me According to this article, pushstate wont refresh page http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/#comment-6552

skos
  • 4,102
  • 8
  • 36
  • 59
A J
  • 45
  • 3
  • 13
  • Shouldn't pushState take 3 strings as arguments? (Not 1 object and 2 strings) – johnnycardy Jan 03 '14 at 12:19
  • Open this fiddle http://jsfiddle.net/LaazN/ and post what message is showing to you. – rogeriolino Jan 03 '14 at 12:21
  • I used that code it worked for me window.history.pushState("object or string", "Title", 'BookAHotel' + hotelSelect); – user2727841 Jan 03 '14 at 12:25
  • @ user2727841 : -well it works, but a second request goes. which i want to prevent. @Ali: i got the code from the post u mentioned, but y a second request goes when i update the url? – A J Jan 03 '14 at 12:29

0 Answers0