Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

capturing history.back(-1) in a token

Featured Replies

  • Newbies

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

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

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

  • Author
  • Newbies

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?

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.

  • Author
  • Newbies

Right. Which means that the javascript that Garry supplied is never setting the token...Any other ideas?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.