To save myself time, I am going to copy this from anothor forum I posted on earlier, and have so far not been able to find a solution.
I am working out some base code for the recoding of a site. We have deicded we want to have an available AJAX interface for users.
Now let me just say I hate Javascript. Never really have liked it. But the web is evolving and so must I.
Now we all know a problem with AJAX is the broken back button, and bookmark failure (and dirrect linking). I have attempted te fix this with the url embeded tag id's Ex a url might resemble:
http://www.site.com/#/forums/topic/1
( note the site uses mod_rewrite)
Obviously their is no tag in the page with that id. Now here is my JS to handle that urls upon loading:
var searchAddr = new RegExp(".#/(\w+/)+(\.html)?");
// Test if they want a certain page. The URL would be formed like so: http://www.mustywind..com/#/forums/topic/1
if ( searchAddr.test( window.location.href ) ) {
var start = searchAddr.lastIndex + 1; // + 1 to get rid of the pound (#) character.
var end = window.location.href.strlen() - start;
callServer(window.location.substr(start, end), 'content', false); // custom function for ajax.
}
The custom function I have there is not important. What is importang as the rest of the code, and the first paramater in that function, which is the page to load from the server.
However when I load up a page in the format of the one above, it does not work. Like I said. I hate Javascript. Not really by thing.
I am working out some base code for the recoding of a site. We have deicded we want to have an available AJAX interface for users.
Now let me just say I hate Javascript. Never really have liked it. But the web is evolving and so must I.
Now we all know a problem with AJAX is the broken back button, and bookmark failure (and dirrect linking). I have attempted te fix this with the url embeded tag id's Ex a url might resemble:
http://www.site.com/#/forums/topic/1
( note the site uses mod_rewrite)
Obviously their is no tag in the page with that id. Now here is my JS to handle that urls upon loading:
var searchAddr = new RegExp(".#/(\w+/)+(\.html)?");
// Test if they want a certain page. The URL would be formed like so: http://www.mustywind..com/#/forums/topic/1
if ( searchAddr.test( window.location.href ) ) {
var start = searchAddr.lastIndex + 1; // + 1 to get rid of the pound (#) character.
var end = window.location.href.strlen() - start;
callServer(window.location.substr(start, end), 'content', false); // custom function for ajax.
}
The custom function I have there is not important. What is importang as the rest of the code, and the first paramater in that function, which is the page to load from the server.
However when I load up a page in the format of the one above, it does not work. Like I said. I hate Javascript. Not really by thing.







