Skip to main content

Bug Tracker

Side navigation

#456 closed bug (wontfix)

Opened November 30, 2006 12:12PM UTC

Closed December 21, 2006 01:39PM UTC

Last modified June 20, 2007 02:23AM UTC

Script tags stripped from innerHTML on .load() (IE5.5)

Reported by: sidebog7 Owned by:
Priority: minor Milestone:
Component: ajax Version:
Keywords: script ajax Cc:
Blocked by: Blocking:

When returning a block of html such as the following the Script tag and anything within is removed. This means that contained script is not executed.

<div>Text</div><script type="text/javascript">alert('Working');</script><div>More Text</div>

On investigating the responseText contains the script, a callback such as

} displays the script, whereas if you perform an
the script is absent.

From further checks setting the innerHTML of an element to a piece of HTML doesn't seem to strip out the script so I am unsure what is causing this.

A fix to this is as reported in bug #16 to add a character (or as I have found to add

<table style="display:none"></table>
in front of the script)

Attachments (0)
Change History (2)

Changed November 30, 2006 08:29PM UTC by joern comment:1

priority: majorminor
version: 1.0

Changed December 21, 2006 01:39PM UTC by joern comment:2

resolution: → wontfix
status: newclosed

A simple workaround is to simply avoid using load to get scripts, use $.getScript instead (and ommit the wrapping html).