Skip to main content

Bug Tracker

Side navigation

#4826 closed bug (invalid)

Opened June 26, 2009 07:30PM UTC

Closed June 15, 2010 03:21AM UTC

Last modified November 19, 2010 01:49AM UTC

Loading HTML with script tag not working consistently

Reported by: mindjoy Owned by:
Priority: minor Milestone:
Component: ajax Version: 1.3.2
Keywords: script tag document.write() Cc:
Blocked by: Blocking:
Description

I have the following HTML page (extract):

<!-- HTML starts here (inside body tag) -->

<input type="button" name="test-load-js" value="Check load JS" onclick="$('#load-js').load('with-js.html');"/>

<div id="load-js">

</div>

<!-- HTML ends here -->

<!-- Content of with-js.html starts here -->

<script type="text/javascript">

<![CDATA[

document.write('It works!');

alert('It works!');

]]>

</script>

<!-- Content of with-js.html ends here -->

This code works as following on Windows after clicking on the button (no error messages in any browser):

SeaMonkey Navigator v1.1.16: Alert executes fine, the button disappears, text 'It works!' displays on the page, and the hourglass keeps running (seems like the script never finishes).

Opera v9.64 and Explorer v6.0.2800.116CO: Alert executes fine, document.write(.) does not execute.

Is this code supported, i.e. should it work as expected: displays text 'It works!' underneath the button, then displays alert? Please advise. Thank you.

John

Attachments (0)
Change History (2)

Changed June 15, 2010 03:21AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

document.write replaces the current page, so executing it will cause problems.

Changed November 19, 2010 01:49AM UTC by dmethvin comment:2

#5225 is a duplicate of this ticket.