Closed Thread Icon

Preserved Topic: Saving a window (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8954" title="Pages that link to Preserved Topic: Saving a window (Page 1 of 1)" rel="nofollow" >Preserved Topic: Saving a window <span class="small">(Page 1 of 1)</span>\

 
Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 11-21-2003 04:53

I'm creating a new window {newWin = window.open()}, writing to it {newWin.document.write(string)}, then wanting to save it through the browsers File -> Save As...
The hitch is that it's trying to save the parent document that created the new window, rather than the content of the new window itself. I'm sure there's some way to do this, but through the lack of sleep and being sick and everything else going on, I've only been able to search Google for about 6 hours the last couple days trying to find something, however nothing's really turned up. I've found one site that has the code I already have, and they do the same thing, but they claim you can save the new window,

quote:
You can click the NEW WINDOW button which will open a new browser window. The study will be displayed in the new window. Use the browser print and save commands (File/Print, File/Save As) on the NEW window.

However, if you go there and try it, when you save the new window, it actually saves the parent document.


What I have right now:

saveWin = window.open("", "saveinfo", "toolbar=no, directories=no, location=no, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=300, height=200, screenX=300, screenY=100, left=300, top=100");
saveWin.document.open(); //not sure if this line is neccessary
saveWin.document.write(Message);
saveWin.document.close();

Does there need to be something in particular as the first parameter of open()?
I've tried creating a seperate file on the server (not through this script or anything, just uploading it myself), using that as the parameter, and as long as I don't do a document.write() to it, it opens that file and you can save it like I want to. However, as soon as you write something to it, when you go to save, it tries to save the parent document.

Or maybe the second parameter? Though I'm not entirely clear on what it's for. You can pass things like "_blank" or "_new" etc, right? Essentially the target attribute in <a href>?


Or maybe there's a whole better way to accomplish what I need... Essentially take a String from a Java applet, open a new window of some sort with that String in it (Notepad would be ideal, possibly with something like: window.location = "view-source:" + window.location.href), so the user can save it as a .txt file, although putting it in a browser and using the built-in File -> Save As... there wouldn't be a problem.
Maybe with PHP? I'm not familiar enough with either JavaScript or PHP to know what level of interaction is allowed/capable between the two. ...Have Java pass a String to JavaScript which passes it to PHP which dynamically creates a page entirely independent of the original page with the applet... That looks like a rather obscure way to achieve this, but if it works, I'll take it for now, at least until I get a chance to do it right.


I suppose that's enough for tonight... Many thanks to any ideas any of ya'll might have,
LF

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-21-2003 12:53

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 11-21-2003 15:32

And the saveWin.document.open(); is necessary for NN4.

Mathieu "POÏ" HENRI

Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 11-21-2003 19:05

InI: Same problem as before, as long as I don't do anything to the new window once it's open, it is fine. But when I do [/i]saveWin.document.open()[/i] it changes the text in the title bar from about:blank to the url of the parent document.

poi: Thanks, I figured it was something along those lines but wasn't sure.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-21-2003 19:26

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu