kirill578 Posted February 24, 2011 Share Posted February 24, 2011 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; Quote Link to comment https://forums.phpfreaks.com/topic/228724-changing-the-url-address-bar-without-reloading-the-page/ Share on other sites More sharing options...
requinix Posted February 24, 2011 Share Posted February 24, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/228724-changing-the-url-address-bar-without-reloading-the-page/#findComment-1179232 Share on other sites More sharing options...
kirill578 Posted February 24, 2011 Author Share Posted February 24, 2011 Ok, so how do i put variable from the address bar info variable, for instance: http://maadif.co.cc/stuff/#!/5 into id = 5; ??? Quote Link to comment https://forums.phpfreaks.com/topic/228724-changing-the-url-address-bar-without-reloading-the-page/#findComment-1179239 Share on other sites More sharing options...
kirill578 Posted February 25, 2011 Author Share Posted February 25, 2011 I have found a solution I redirect http://maadif.co.cc/stuff/#!/ to http://maadif.co.cc/stuff/ Quote Link to comment https://forums.phpfreaks.com/topic/228724-changing-the-url-address-bar-without-reloading-the-page/#findComment-1179434 Share on other sites More sharing options...
kirill578 Posted February 25, 2011 Author Share Posted February 25, 2011 ohh this hasn't solved the problem Quote Link to comment https://forums.phpfreaks.com/topic/228724-changing-the-url-address-bar-without-reloading-the-page/#findComment-1179441 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.