Title: WP doesn&#8217;t accept &#8220;Javascript: history.back(-1)&#8221;
Last modified: August 18, 2016

---

# WP doesn’t accept “Javascript: history.back(-1)”

 *  [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/)
 * Hello everyone!
 * My problem is the following: whenever I want to insert this
    `<a href="Javascript:
   history.back(-1);">« Back</a>` into a WordPress page, it is always edited by 
   WP into this: `<a href="http://audrey-tautou.org/Javascript: %20history.back%
   28-1%29;">« Back</a> (site is Audrey-Tautou.org)
 * Does anyone know why that simple Javascript is not accepted? Anything I can do?
 * Thanks,
    Manila

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [bpartch](https://wordpress.org/support/users/bpartch/)
 * (@bpartch)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-430937)
 * Hello
 * Seems to work for me, where are you pasting it, in a post/page or into a theme
   file?
 *  Thread Starter [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431013)
 * Hi!
    I want to post it in a page.
 *  [Jonathan Landrum](https://wordpress.org/support/users/jonlandrum/)
 * (@jonlandrum)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431019)
 * I was having problems running JS from within the loop like that, but there may
   be a plugin that lets you do something like this. Also, try putting the JS in
   the page template itself, rather than putting it in the content of the post. 
   This page has a lengthy article on the subject: [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 *  Thread Starter [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431021)
 * Thanks! I put the JS into the page template and now everything works 🙂
 * Another question: Why does WP also edit the 
    out? I can put as many  or <br>
   into a page template, it is always removed o__Ô
 *  [Jonathan Landrum](https://wordpress.org/support/users/jonlandrum/)
 * (@jonlandrum)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431025)
 * It’s editing tags that are in the template or the post? If it’s in the post, 
   that’s part of the reason JavaScript and PHP won’t work well in a post. WP automatically
   escapes certain characters, such as breaks and apostrophes.
 *  Thread Starter [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431031)
 * It’s editing tags in a post/page. Whenever I put a <br>-tag into a post/page 
   and I update it, it is not there anymore later.
 * Anything I can do?
 *  [Jonathan Landrum](https://wordpress.org/support/users/jonlandrum/)
 * (@jonlandrum)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431034)
 * Just hit `Enter`. That gives a carriage return (line break) in the post automatically.
 *  Thread Starter [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431047)
 * Yes, but only once. If I click “Enter” several times for more space between things,
   it won’t work.
 *  [Jonathan Landrum](https://wordpress.org/support/users/jonlandrum/)
 * (@jonlandrum)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431054)
 * Why not use CSS? Put the next bit of text in a div with `padding-top` set to 
   something like `2em` or whatever.
 *  Thread Starter [manila](https://wordpress.org/support/users/manila/)
 * (@manila)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431064)
 * Thanks jonlandrum, I’m gonna check that out 🙂

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘WP doesn’t accept “Javascript: history.back(-1)”’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 3 participants
 * Last reply from: [manila](https://wordpress.org/support/users/manila/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/wp-doesnt-accept-javascript-historyback-1/#post-431064)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
