You use ajax or? It’s possible to have history with jquery (here is plugin http://tkyk.github.com/jquery-history-plugin/) but it’s impossible to have it with structure like this “/asd” because browser would detect it as new page, so you will always see “#” in url (with this, browser knows it’s DOM and not new page to load)
To change the url path in the browser you have to update window.location, and that always refreshes the page.
If you could change the URL path via javascript, think of the security implications. It’d make phishing even more of a problem (change the URL to a bank’s URL and give you a login form, for example). So browser’s don’t allow this (you can change the hash/fragment, just not the path).
I assume you’re looking at this for some AJAX functionality. My method was to change the hash/fragment value and then detect this on page load in order to make it bookmark-able. Good luck
I think this might be considered a security issue so browsers would block JavaScript functions like this. It’s the kind of thing a phishing website would do so typically these types of access are not allowed.
Even Facebook and Twitter are using the Hash symbol to change there URL without refreshing everything.
I used the same method for my WP template, didn’t find a better way. The hardest thing to do is to read that hashed URL and load the right content if for example you’re sending a specific link to someone or even to twitter!
I think this might be considered a security issue so browsers would block JavaScript functions like this. It’s the kind of thing a phishing website would do so typically these types of access are not allowed.
security issue on same domain? cross-domain attacks are something else…
he is just asking how to change url lol…xss, xsrf are something else
modern phishing attacks are done through code injections (vulnerable parameter exploited)
I think this might be considered a security issue so browsers would block JavaScript functions like this. It’s the kind of thing a phishing website would do so typically these types of access are not allowed.
security issue on same domain? cross-domain attacks are something else…
he is just asking how to change url lol…xss, xsrf are something else
modern phishing attacks are done through code injections (vulnerable parameter exploited)
I think this might be considered a security issue so browsers would block JavaScript functions like this. It’s the kind of thing a phishing website would do so typically these types of access are not allowed.
security issue on same domain? cross-domain attacks are something else…
he is just asking how to change url lol…xss, xsrf are something else
modern phishing attacks are done through code injections (vulnerable parameter exploited)
I think this might be considered a security issue so browsers would block JavaScript functions like this. It’s the kind of thing a phishing website would do so typically these types of access are not allowed.
security issue on same domain? cross-domain attacks are something else…
he is just asking how to change url lol…xss, xsrf are something else
modern phishing attacks are done through code injections (vulnerable parameter exploited)
oh mister Smart A**, are you always so smart or it’s just today?
he is talking about URI changing not complete url…uri is other part after .tld (like /index.php)
best wishes ^^
My understanding of browser security is it doesn’t matter if it’s URI or URL, it’s blocked deliberately. If it was not being blocked by the browser you should be able to do it. So far nobody seems to have come up with a solution that doesn’t involve a hash “#” in it.
An example of changing the URI being a security issue would be a site that provides customer pages as sub-directories of their domain: “mycompany.com/myUserName”, like Facebook for instance… If allowed by the browsers without a refresh, I could add some JavaScript to spoof this URI and make it look like you are viewing “mycompany.com/tos” or “mycompany.com/login”. See how it’s a security issue now?
It isn’t blocked because of security, it’s blocked because browser can’t recognize if it’s new page to load or same…that’s why # (hashchange tag event) is added, so browser know it shouldn’t load new page…don’t understand how you guys can’t figure out simple things like this lol
I’ve done it with #. Pretty much the only way to do it. On its own it’s nothing, but with a bit of javascript it can become useful. Really depends on what you’re trying to achieve.
Generally you add some # content at the end like: yoursite.com/#?foo=mooyoursite.com/#?bar=cow when you’re loading something on the page with ajax and you would like the user to be able to navigate back/forward and bookmark the page.
No point loading all your different page content via ajax on yoursite.com if the user can’t bookmark it or back/forward navigate.
This bit of javascript might help you on the way. It should detect the # on page load and redirects to the real page.
var current_hash = location.hash;
current_hash = current_hash.replace(/#/,'');
if(current_hash.length>1){
// we have something after the #. redirect as if the # wasn't there.
window.location.href=current_hash;
}
check out how facebook works with it’s #, navigate around a bit and then hit the refresh button, notice how the url changes to what was after the #.