/    Sign up×
Community /Pin to ProfileBookmark

browser spinning after page load

The following function is called by a “print” button on my page. The new window is opening and the page is rendering. However, IE seems to get hung trying to re-download the stylesheet or an image or something. Netscape 7 just continues to spin (load) although I have no clue what action it’s trying to perform. I can’t view the page source, which make me think the page isn’t finished loading. The source comes up and appears correct in IE.

Any help would be appreciated.

function printSp1()
{
if (document.getElementById != null)
{
var html = ‘<HTML>n<HEAD>n’;

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName(“head”);
//if (headTags.length > 0)
// html += headTags[0].innerHTML;
}
html +=’n<link rel=”stylesheet” href=”/css/style.css” type=”text/css”>n’;
html += ‘n</HEAD><BODY>n’;
var printReadyElem = document.getElementById(“printReady”);

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert(“Could not find the printReady section in the HTML”);
return;
}
alert(html);
html += ‘n</BODY></HTML>n’;

var storyWin = window.open(“”,
“StoryWin”,
“toolbar=yes,width=900,height=400,status=yes,scrollbars=yes,menubar=yes”);
with (storyWin.document) {
write(html);
}
}
else
{
alert(“Sorry, the print ready feature is only available in modern browsers.”);
}

}

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJan 05.2004 — Try close(html) after the write(html)
Copy linkTweet thisAlerts:
@MemphisBagmanauthorJan 05.2004 — that got it... can't believe overlooked something so simple. Thanks for your help!
×

Success!

Help @MemphisBagman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...