Re: opening a new window with HTML code instead of file
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: opening a new window with HTML code instead of file

From: askMe <askMe@askblax.com>
Date: Tue Aug 23 2005 - 10:59:37 CEST

Csaba Gabor wrote:
> laredotornado@zipmail.com wrote:
> > Hello,
> > I am searching for a cross-browser way (the most recent browsers
> > are fine) to use javascript to open a new window even though I do not
> > know the file I want to call. I do, however, know the HTML code I want
> > output in the new window. It would look like
>

You would have to change the "about:blank" to a "/" or something to get
the address bar to look right.

function javascripttest()
{
        var newWin = window.open("/");
        newWin.document.open();
        newWin.document.write("<body>My virtual web page <BR> is what you
see!</body>");
        newWin.document.title = "My virtual title";
        newWin.document.close();
        return;
}

http://www.askblax.com

> var newWin = window.open("about:blank");
> newWin.document.open();
> newWin.document.write("<body>Some text</body>");
> newWin.document.close();
> newWin.document.title = "My favorite title";
>
> See also perhaps the recent discussion at:
> http://groups.google.co.uk/group/comp.lang.javascript/browse_frm/thread/18a60664279d6460/
>
> Csaba Gabor from Vienna
Received on Tue Oct 18 03:11:50 2005