Unless this is HTML 5 where I can easily use history.pushState() to manipulate URL when AJAX loads additional piece of page, I find it inconvenient to handle pages registered with hash mark in URL address bar.
For example, page item1.html is loaded. User clicks next item – item2.html page is loaded with AJAX. Address is changed in the browser to item1.html#item2.html.
Now as user sends this URL to a friend or bookmarks it, I want to make sure item2.html is loaded.
Approach 1) JavaScript will redirect URL item1.html#item2.html to item2.html. Disadvantage: item1.html is loaded and flickers for a second before redirect.
Approach 2) load item1.html and hide item1 content, then load item2.html with Ajax request. Disadvantage: item1 content can still be visible (unless I hide it with visibility none which may be bad for SE’s)
Better approach? There must be a great solution I am missing that many big sites implement.
Don’t think of the # part as a url to a file. It’s a logical state for the page to be in.
For you I think that means having like a page.html, which maybe has no real content on its own. Then you have page.html#item1 and page.html#item2, etc. The urls are always consistent. You’d never really directly navigate to item1.html or item2.html.