Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#4826 closed bug (invalid)

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:


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.


Change History (2)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

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

comment:2 Changed 12 years ago by dmethvin

#5225 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.