Newbies sb_folk_boy Posted September 18, 2004 Newbies Share Posted September 18, 2004 I am simply trying to capture the webpage from where users linked to my survey in a token, so that while the user is in the midst of my survey they can hit an exit button which will take them back to that webpage. I tried this, but it did not work: <input type="hidden" name="-token.9" value="[javascript:history.back(1)]" Thanks for your help SBFB Link to comment Share on other sites More sharing options...
Steve T. Posted September 21, 2004 Share Posted September 21, 2004 Hmm... logic seems sound to me although I am not familiar w/JS enough to know anything about history.back(1). All I can think of is to test if [javascript:history.back(1)] returns the correct value of what you want and if so, check to see if WHERE code is on the page matters. Working with PHP for the 1st time this summer, I found that sometimes it matters where code is located in the sequence of execution (e.g. code dealing with headers will not work in body)... maybe history is header-specific? Good luck, tho... --ST Link to comment Share on other sites More sharing options...
Garry Claridge Posted September 22, 2004 Share Posted September 22, 2004 The Javascript will not "render" a string. It is a function/method of the "history" class, hence it does something when asked. You may be able to do it like this: <script> document.write('<input type="hidden" name="-token.9" value="' + window.history[history.length-1] + "'>'); </script> Good Luck. Garry Link to comment Share on other sites More sharing options...
Newbies sb_folk_boy Posted September 25, 2004 Author Newbies Share Posted September 25, 2004 Thanks for the input....but the javascript doesn't seem to work. When I check what is in token 9 on the following page it is blank. Any other ideas? Link to comment Share on other sites More sharing options...
Unable Posted September 25, 2004 Share Posted September 25, 2004 Re: When I check what is in token 9 on the following page it is blank. If a token is blank on the next page that means the token has not be set. Link to comment Share on other sites More sharing options...
Newbies sb_folk_boy Posted September 30, 2004 Author Newbies Share Posted September 30, 2004 Right. Which means that the javascript that Garry supplied is never setting the token...Any other ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7283 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now