Title: Placing JavaScript in Posts
Last modified: August 18, 2016

---

# Placing JavaScript in Posts

 *  [WildBil2Me](https://wordpress.org/support/users/wildbil2me/)
 * (@wildbil2me)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/)
 * I currently run a small gaming blog and was interested in plugging JavaScript
   into the occasional post. There are times when I can get away with an embedded
   YouTube video, but sometimes I have to rely on sites that only offer embeddable
   videos via JavaScript.
 * Right now, if I put JavaScript in a post the script is stripped when the post
   is served.
 * I’ve checked the Plugin Database but got no results. The codex offers an option
   for putting things into posts but it isn’t realistic for my needs.
 * Before I attempt writing a plugin I’m curious if anyone knows of an existing 
   plugin or method for serving JavaScript videos in posts.
 * Thanks in advance for any help.

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

 *  [vkaryl](https://wordpress.org/support/users/vkaryl/)
 * (@vkaryl)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461397)
 * Are you using the Rich Text Editor/wysiwyg to input posts? If so, it does strip
   code; disable it through wp-admin/Users/Your Profile, scroll to the bottom, uncheck
   the box on the left.
 * And you can try surrounding your js with CDATA tags. I don’t know that that will
   work, but trying it couldn’t hurt.
 *  Thread Starter [WildBil2Me](https://wordpress.org/support/users/wildbil2me/)
 * (@wildbil2me)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461482)
 * It’s not an issue of using the Rich Text Editor. Both in and out of the WYSIWYG
   editor JavaScript tags will be stripped – I also don’t use the WYSIWYG and never
   have.
 * I’ll try with CDATA tags tonight but to be honest I’m not very familiar with 
   them or their usage.
 * Any other suggestions?
 *  [vkaryl](https://wordpress.org/support/users/vkaryl/)
 * (@vkaryl)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461486)
 * Nope. I never insert code in posts. If I’m using adsense or something it’s in
   sidebar or footer.
 * Could be some really complex escaping you could do, though again, I’m not much
   help, sorry.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461502)
 * It’s wordpress doing this, actually. Here’s a quick plugin I cooked up a while
   back to change this functionality.
 * [Script Enabler](http://ottodestruct.com/wpstuff/scriptenabler.zip)
 *  Thread Starter [WildBil2Me](https://wordpress.org/support/users/wildbil2me/)
 * (@wildbil2me)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461595)
 * Thanks Otto42, I knew that WordPress’ engine was stripping the tags and had assumed
   it was a security thing. I’ll check out your plugin and check back.
 *  [wifiman01](https://wordpress.org/support/users/wifiman01/)
 * (@wifiman01)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461901)
 * Otto42,
 * Plugin seems not working.
 * (PS : Already posted in another topic )
 *  [banabliss](https://wordpress.org/support/users/banabliss/)
 * (@banabliss)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461910)
 * I’m trying to put Javascript in a post too. Actually what I want to do is illustrated
   perfectly at [http://www.duffypov.com](http://www.duffypov.com). They have galleries
   within posts that look to me like javascript, because they load a new image on
   click of a thumbnail without reloading the page. I’ve never done javascript but
   I just want this to work. My boss told me to find the grand poobah of wordpress
   and ask. Hopefully the grand poobah is out there. Help!
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461911)
 * The “perfect illustration” is password protected… in other words useless, so 
   we have no idea what do you have in mind.
 *  [mike13](https://wordpress.org/support/users/mike13/)
 * (@mike13)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461912)
 * I think WP strips off javascript any, to avoid security bugs such as cross site
   scripting.
 * Javascript could access document.cookie, and so steal cookies. Sure, from your
   own site, but think about “shared” blogs.
 * Additionally, a href.location(“[http://www.ebay.com/buyitem.php?id=12334&#8221](http://www.ebay.com/buyitem.php?id=12334&#8221););
   could you make buy strange things.
 * Okay, the ebay thing probably still needs other things, but you get the idea…
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461913)
 * Don’t think. Read the documentation:
    [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)

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

The topic ‘Placing JavaScript in Posts’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 10 replies
 * 7 participants
 * Last reply from: [moshu](https://wordpress.org/support/users/moshu/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/placing-javascript-in-posts/#post-461913)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
