Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#456 closed bug (wontfix)

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 function(html){alert(html);} displays the script, whereas if you perform an ALERT($('element').html()); 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)

Change History (2)

comment:1 Changed 16 years ago by joern

Priority: majorminor
Version: 1.0

comment:2 Changed 16 years ago by joern

Resolution: wontfix
Status: newclosed

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

Note: See TracTickets for help on using tickets.