Skip to content Skip to sidebar Skip to footer

What Should I Use Instead Of Document.write For A Popup

in my web page, I am opening a popup window and generate the HTML for the popup using JavaScript/jQuery: var site=' ............. '; var popupWindow = wind

Solution 1:

You have to close the document when you'r done writing:

var site="<html> ............. </html>";
var popupWindow = window.open("","","menubar=0,scrollbars=0");
popupWindow.document.write(site);
popupWindow.document.close();

Solution 2:

popupWindow.document.close();

Adding this to the end will solve the issue. I have found it here before : http://p2p.wrox.com/javascript-how/36703-javascript-popup-keeps-loading.html

Solution 3:

You should use jQuery's append()

var win = window.open();
    var popup = win.document.body;
    $(popup).append('site html');

Or innerHTML

var popup = window.open();
popup.document.body.innerHTML = 'site data here';

Post a Comment for "What Should I Use Instead Of Document.write For A Popup"