url and back button
I use ajax function (jquery).
Is there any possibility to disable changing url in browser???
My problem is that i loading content.html when im on mainpage and the link is changing in browser.
For example mainpage.html#content
I want to block it im intrested in situation: mainpage.html not mainpage.html#content becouse i want to disable back(browser) button only if its ajax event.
Thanks for reply
try using other elements instead of <a></a> to trigger your ajax functions. i mean
<a href="#null" onclick="somefunction()">text</a>
replace with let's say
<img src="boobs.jpg" alt="big ones" onclick="somefunction()" />
xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
You don't say why you are getting '#content' in the URL when you run AJAX to load a div with content...
But... if you want to use <a>'s to run a JS function and have the URL not change, there are two methods available for you. I think both are cross-browser compatible, but it has been awhile since I've tested them in something other than FireFox. (Instead of using anchors, I do as Padonak suggests... I tend to use stylized <span>s for AJAXy text links.)
Method 2: add "return false;" to your onclick
Notice in this one, if you remove the "return false", the URL will change to "test.html#goober", but it does not with the return false in place.
<a href="#goober" onclick="someFunction(); return false">AJAXy Link Here</a>
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)