Search code examples
ajaxurlhashtaghtml4

Why is # (hashtag) included in websites with ajax?


I did some research on the reason why # (hashtag) is used in a URL when ajax is used, but I couldn't find an answer. Can you help me?


Solution

  • Hashtags are added to the URL when using AJAX because AJAX doesn't change the url and then if you click Previous button of the browser after doing many AJAX requests, you will be moved to a very earlier page ( because the browser will consider all Ajax generated pages as one page because they gave one URL). That's why Hashtags are added to simulate the movement from one page to an other. and then the Previous/Next buttons of the browser will work just fine.