kmt333
asked on
javascript "back" image within ASP.NET application
I love asp.net, but it's the simple things that can be really difficult. Here's my latest challenge. I have an image (btnBack) that I want the user to be able to click and (you guessed it) go back. I set it up first as an image button and passed the js onclick information to it both via code-behind with attribute.add and with the OnClientClick function. In both cases, the page refreshed, but did not go back (NOTE: i tried both window.history.back and window.history.go(-1)).
i then moved to using a hyperlink around the image with href="#' and an onclick function, but same result. to further test my onclick function, i wrote it up separately as "goBack()" and added a first step of an alert("function triggered") so that it looked like the function below:
function goBack() {
alert("function triggered");
window.history.back;
}
at this point the function worked, BUT if i remove the alert (and hence the user interaction), it does not work. in case it was a timing issue, i tried using a settimeout, but this did not help either. what a pain in the ass, i just want to access the browser's back button behavior without making a call to the server.
thanks in advance for your assistance.
kmt
i then moved to using a hyperlink around the image with href="#' and an onclick function, but same result. to further test my onclick function, i wrote it up separately as "goBack()" and added a first step of an alert("function triggered") so that it looked like the function below:
function goBack() {
alert("function triggered");
window.history.back;
}
at this point the function worked, BUT if i remove the alert (and hence the user interaction), it does not work. in case it was a timing issue, i tried using a settimeout, but this did not help either. what a pain in the ass, i just want to access the browser's back button behavior without making a call to the server.
thanks in advance for your assistance.
kmt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
kmt