[thelist] Popup window and Safari

Chris Heilmann lists at onlinetools.org
Wed Jan 19 08:05:43 CST 2005

> I'm opening a popup window on safari with the intension to populate it's
> contents with JS.  When I do so, I see the content for a moment, then
> safari
> loads the parent window's page.  Sample code:
> t = 'Popup Window Content';
> attributes = '...';
> preview_win = window.open('#', 'window_preview', attributes);
> win = preview_win.document;
> win.open();
> win.write('<html><head>');
> win.write('<style type="text/css">Some style stuff here...</style>');
> win.write('</head><body>');
> win.write(t);
> win.write('</body></html>');
> win.close();

This is a horrible idea, as it will only work with JS enabled. If you want
to do an image preview, why not use a pop-under instead?
That way you can use a proper link to the image for non-css non-js
browsers and you don't need to muck about with popups:

I just finished an article with galleries done that way that will be
published on devpapers soon:


Chris Heilmann
http://icant.co.uk/ | http://www.onlinetools.org/

More information about the thelist mailing list