Jump to content

Changing the URL address bar without reloading the page.


kirill578

Recommended Posts

Is it possible that to change the address to something else with out reloading the page? I understand that if it were possible it could make a real security issue (Phishing and so on). but I need it just to change the value of some GET variable , in case some of the user want to share this page on facebook or send the perticiler page to someone. ( all the website is just one page and it's using AJAX ) There is the website in case you didn't got the point:

 

http://maadif.co.cc/stuff/

 

!-! currently I use \/ but it does refresh the page.

 

window.location.href = "http://maadif.co.cc/stuff/?id=" +question_id;

 

No, you can't change it without redirecting the user.

 

Most of it, that is. You can use fragments (the stuff after the # in the URL) instead: you can change those all you want without reloading the page. Like somebody (I forget who) has URLs like

http://www.example.com/#!/do/something/cool

The downside is that you need a fair bit of JavaScript to support it, as somebody might go there directly without going through your code first.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.