javascript:history.go(-1) in template being rewritten with WCMS path

fuelishways's Avatar

fuelishways

10 Aug, 2012 07:38 PM

I'm trying to include an href with "javascript:history.go(-1)" as the path in a template, but every time i go to publish it, wcms rewrites it with a wcms relative path. how can i include this javascript in my template?

  1. 1 Posted by Ryan Griffith on 10 Aug, 2012 08:07 PM

    Ryan Griffith's Avatar

    Hi fuelishways,

    This is a known defect in Cascade that causes links containing javascript: to be incorrectly rewritten during Template submission. Feel free to track the status of this issue using the link I have provided to see if it has been resolved in a future version of Cascade.

    In the meantime, there are a few workarounds that you could try:

    • Use the onclick method instead. For example: <a href="#" onclick="history.go(-1)">Go back</a>
    • Add the link to either an XHTML Block or a Format, the href should be left alone.

    Please let us know if you have any questions.

    Thanks.

  2. 2 Posted by fuelishways on 10 Aug, 2012 08:13 PM

    fuelishways's Avatar

    The onclick method doesn't seem to work in chrome. It also doesn't work in iOS.

  3. 3 Posted by Ryan Griffith on 13 Aug, 2012 12:48 PM

    Ryan Griffith's Avatar

    It looks like Chrome and Safari (iOS) are a little more finicky. Let's try the following:

    <a href="#" onclick="history.go(-1);return false;">Go back</a>
    

    Please let me know if this works out for you.

    Thanks.

  4. fuelishways closed this discussion on 21 Aug, 2012 05:38 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac