Click to See Complete Forum and Search --> : Tough problem with SaveAs


karayan
06-07-2003, 06:52 PM
This is a challenging problem.

With my Javascript, I am oponing another window and load a certain HTML file (using IE). Then, the Javascript modifies the HTML on that window. I want the user to save the window using the SaveAs command from the menu, so the page can be saved as a Web page (with images, etc.) The trouble is, when the user selects File --> Save As, IE saves the original HTML file, not the modified HTML.:(

How can the user save the modified code?????

I think that the execCommand(SaveAs) will nit work either. (Plus which, it does not save the whole web page -- just the HTML file).

Here is my current thnking, but feel free to give me another solution:

If I can specify the document HTML, (maybe through innerHTML???), can I send that document (already modified)to the new Window (without opening an HTML file)? And if the user saves that, I asume that the modified code will be saved?

This is really a sticky point that I must overcome.

Thanks.

George

Jona
06-07-2003, 07:55 PM
This is because it downloads the page from the server--and JavaScript has no access to server files (thank goodness, otherwise we'd all be in serious trouble!), so you would have to edit the files with some server-side language instead.

Jona

karayan
06-07-2003, 08:07 PM
There is no server-side involved here. This is all local, done on the user's computer, owrking off HTML files off the disk. The user doesn't even need to be connected to the Internet!

What will happen if I read the body.innerHTML, modify it, and then open an empty window and use write() to place the new HTML into it? Then the user saves it as a web page. Will that work?

Boy, am I stuck?
George:confused: