Link to home
Start Free TrialLog in
Avatar of kmt333
kmt333Flag for United States of America

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
ASKER CERTIFIED SOLUTION
Avatar of baretree
baretree
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kmt333

ASKER

bless you!  what i actually needed was to specify the "return".
kmt