GuardianGI Posted October 6, 2010 Share Posted October 6, 2010 this is more of an AJAX related issue so I'm not entirely sure if this is where I should put it, anyway... I want to load articles/pages etc. using AJAX into my main page and ofcourse have my content div change if someone clicks to load a new page (you know basic AJAX...) the problem is I want to display a different URL path to my users browser everytime the page is changed using AJAX. I've already set up a way to load my pages entirely if JS (or the AJAX function) isn't working however now I want that page's url to be displayed in the URL bar, to be added to the browser history etc. is there a (good) way of doing all this? or would it be better to just ditch the AJAX and load the custom pages even on systems that support AJAX? Quote Link to comment https://forums.phpfreaks.com/topic/215299-ajax-and-linkingbookmarkinghistory/ Share on other sites More sharing options...
trq Posted October 7, 2010 Share Posted October 7, 2010 You can use anchors within your links, then have certain Ajax functionality execute when the anchors are found in the url. Quote Link to comment https://forums.phpfreaks.com/topic/215299-ajax-and-linkingbookmarkinghistory/#findComment-1119667 Share on other sites More sharing options...
GuardianGI Posted October 7, 2010 Author Share Posted October 7, 2010 yes but can I use javascript to in this case add something to browser history and edit a displayed url? I want my users to be able to link some one to the page they are on simply by copying it form the url bar, I want hem to be able to use their history to navigate back I want them to be able to bookmark using their browsers bookmark functions. I am very much afraid the easiest way of doing this would be to not use AJAX at all to load pages :'( I can still use it for submitting forms etc. but I'd like to load main content with it as well but I don't want any functionality to be lost... Quote Link to comment https://forums.phpfreaks.com/topic/215299-ajax-and-linkingbookmarkinghistory/#findComment-1119681 Share on other sites More sharing options...
GuardianGI Posted October 7, 2010 Author Share Posted October 7, 2010 sorry for double post but I can't find the edit button any way all i could come up with by googling was this: http://onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-button.html?page=1 which IMO is a dirty fix that doesn't even solve all my problems. I basically want the browser to think the page listed in the href was loaded (which it in fact was but by only getting a part from it using AJAX and ignoring all the unchanged stuff) but i think the easiest way to make the browser think this is by in fact letting it load the page, however I would like to know if it is possible to do things differently. I can imagine it is not because it could posse a security risk for users of browsers that would allow this(display a malicious site that looks like Google and display google.com in url bar would make it rather hard for an end user to know they are in fact not on Google xD) but I figured it was worth asking anyway Quote Link to comment https://forums.phpfreaks.com/topic/215299-ajax-and-linkingbookmarkinghistory/#findComment-1119688 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.