/    Sign up×
Community /Pin to ProfileBookmark

document.close(); doesn’t work in Safari 1.3 and 2

Hi,
I am using document.write() to generate a new page with an mp3 in an iframe.
At the end of the function there is a document.close() tag which used to work.

Now with the new Safari (1.3 and 2) it gets ignored, the pages get written one on top of another and all music tracks play at once.

You can view the site at [url]http://www.anabelcentral.com[/url] (but it only won’t work in the latest Safari – the rest of the browsers seem fine)

Please help me if you can,
Thanks
Jenny

Below is the code that I need help with:

[CODE]function setMusic(link, name) {
mywindow = parent.mp3;
mywindow.document.write (
‘<html><body link=”#000000″ vlink=”#000000″ alink=”#000000″>’ +
‘<table width=”308″ cellpadding=”0″ cellspacing=”0″ border=”0″>’ +
‘<tr>’ +
‘<td align=”right”>’ +
‘<img src=”img/spacer.gif” width=”1″ height=”16″ border=”0″><br>’ +
‘<object classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” width=”270″ height=”16″ codebase=”http://www.apple.com/qtactivex/qtplugin.cab”>’ +
‘<param name=”src” value=”tracks/’ + link + ‘.mp3″>’ +
‘<param name=”AUTOPLAY” value=”true”>’ +
‘<param name=”CONTROLLER” value=”true”>’ +
‘<embed id=”embed1″ src=”tracks/’ + link + ‘.mp3″ width=”270″ height=”16″ autoplay=”true” controller=”true” pluginspage=”http://www.apple.com/quicktime/download/”>’ +
‘</embed>’ +
‘</object><br>’ +
‘<font style=”font-family: Verdana, Helvetica, Arial; font-size: 11px; font-style: normal”><a href=”tracks/’ + link + ‘.mp3″ target=”_blank” style=”text-decoration: none; border-bottom: 1px dotted #000000″>’ + name + ‘</a><br>’ +
‘<font style=”color: #75AB4D”>right click song name to download</font>’ +
‘</font>’ +
‘</td>’ +
‘</tr>’ +
‘</table>’ +
‘</body></html>’);
mywindow.document.close();
}[/CODE]

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@jmaresca2005May 13.2005 — try browser detection and come up with a work around to get the same effect you want. have the browser re-direct point to the workaround when they use safari.
Copy linkTweet thisAlerts:
@jvolvovskiauthorMay 13.2005 — I think that's a good idea.

The only problem is that I don't know of any work arounds. This was the only way I could get it to work before.

Do you have any suggestions?
Copy linkTweet thisAlerts:
@JPnycMay 13.2005 — As far as I know, most of the major browsers only allow you to close a window with script, if you opened it that way, in other words a popup. Firefox and Opera I believe will ignore the window.close() command also, if you didn't open it. IE will throw up a prompt.
Copy linkTweet thisAlerts:
@jvolvovskiauthorMay 13.2005 — Hmm, it's working fine in Firefox and IE on the Mac and PC as far as I've seen.
Copy linkTweet thisAlerts:
@memarkMay 16.2005 — Perhaps you've changed something now, but it looks fine in Safari 2 under Tiger.
×

Success!

Help @jvolvovski 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,
)...