473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Dynamically created pages are not saved in IExplorer

I want the user to be able to save the information displayed on a
dynamically created page.

When I write a script like the following:

<SCRIPT>
winNew = window.open("","test");
winNew.document.writeln("Hello World!");
winNew.document.close();
winNew.focus();
</SCRIPT>

I can view it in IExplorer and if I view code I only see the "Hello World"
part.
But when I try to save it, I get the parent code (as I have typed above).
In Netscape navigator I get the "Hello World", which is what I want.

Do I need to change a setting in IExplorer?

Or does IExplorer need different JavaScript code for this to work.

I must use IExplorer.

Dave
Jul 23 '05 #1
3 1688
The Pritchard wrote:
I want the user to be able to save the information displayed on a
dynamically created page.

When I write a script like the following:

<SCRIPT>
winNew = window.open("","test");
winNew.document.writeln("Hello World!");
winNew.document.close();
winNew.focus();
</SCRIPT>
This should read

<script type="text/javascript>
var winNew = window.open("","test"), d;
if (winNew && (d = winNew.document))
d.open("text/html");
d.write(
['<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict"',
' "http://www.w3.org/TR/html4/strict.dtd">',
'<html>',
' <head>',
' <title>foo<\/title>',
' <\/head>',
' <body>',
' <p>Hello World!<\/p>',
' <\/body>',
'<\/html>'
].join("\n"));
d.close();

if (winNew.focus)
{
winNew.focus();
}
</script>
[...]
I can view it in IExplorer and if I view code I only see the "Hello World"
part.
But when I try to save it, I get the parent code (as I have typed above).
[...]
Do I need to change a setting in IExplorer?

Or does IExplorer need different JavaScript code for this to work.
No, you don't. Provided that it does not work with dynamically
written Valid HTML as well (see above), it is simply borken.
I must use IExplorer.


If you need to use buggy software, you need to build the document
server-side (as it is unlikely that this will get fixed by M$;
but that's the only reliable way doing it anyway) or ask the user
to use View Source and Save (in the menu of the Notepad window that
pops up by default).
PointedEars
Jul 23 '05 #2
Thank you for your help.
I tried the code you suggested and get the same result.
I have never worked on the server-side.
But I will look into that avenue.
It seems a bit much to ask the user to view the code and save it but that
will have to do for now.
It helps to know it is not the code.

Dave

"Thomas 'PointedEars' Lahn" <Po*********@nurfuerspam.de> wrote in message
news:40**************@PointedEars.de...
The Pritchard wrote:
I want the user to be able to save the information displayed on a
dynamically created page.

When I write a script like the following:

<SCRIPT>
winNew = window.open("","test");
winNew.document.writeln("Hello World!");
winNew.document.close();
winNew.focus();
</SCRIPT>


This should read

<script type="text/javascript>
var winNew = window.open("","test"), d;
if (winNew && (d = winNew.document))
d.open("text/html");
d.write(
['<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict"',
' "http://www.w3.org/TR/html4/strict.dtd">',
'<html>',
' <head>',
' <title>foo<\/title>',
' <\/head>',
' <body>',
' <p>Hello World!<\/p>',
' <\/body>',
'<\/html>'
].join("\n"));
d.close();

if (winNew.focus)
{
winNew.focus();
}
</script>
[...]
I can view it in IExplorer and if I view code I only see the "Hello World" part.
But when I try to save it, I get the parent code (as I have typed above). [...]
Do I need to change a setting in IExplorer?

Or does IExplorer need different JavaScript code for this to work.


No, you don't. Provided that it does not work with dynamically
written Valid HTML as well (see above), it is simply borken.
I must use IExplorer.


If you need to use buggy software, you need to build the document
server-side (as it is unlikely that this will get fixed by M$;
but that's the only reliable way doing it anyway) or ask the user
to use View Source and Save (in the menu of the Notepad window that
pops up by default).
PointedEars

Jul 23 '05 #3
The Pritchard wrote:
I want the user to be able to save the information displayed on a
dynamically created page.

When I write a script like the following:

<SCRIPT>
winNew = window.open("","test");
winNew.document.writeln("Hello World!");
winNew.document.close();
winNew.focus();
</SCRIPT>

I can view it in IExplorer and if I view code I only see the "Hello World"
part.
But when I try to save it, I get the parent code (as I have typed above).
In Netscape navigator I get the "Hello World", which is what I want.

Do I need to change a setting in IExplorer?

Or does IExplorer need different JavaScript code for this to work.

I must use IExplorer.

Dave


When you do File -> Save As... in Internet Explorer, choose "Web Page, HTML
only" rather then "Web Page, complete". If you File -> Save As... the result
of a document.write() to a new window in Internet Explorer as "Web Page,
complete", it does indeed insert a couple of headers, as well as the tags you
left out, in addition to the source of the script that produced the new
window.

<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY>
<SCRIPT>
winNew = window.open("","test");
winNew.document.writeln("Hello World!");
winNew.document.close();
winNew.focus();
</SCRIPT>
</BODY></HTML>

This is unusual, but not entirely incorrect behaviour. To obtain a "complete"
Web Page, Internet Explorer would need all the code that led up to the
resulting window. I wonder what it would do with more complex situations
(opened windows that wrote content that opened a window that wrote content
that opened a window).

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gopal Krish | last post by:
I'm have coded a simple menu (using link buttons as menu items) in a user control to be reused across many ASPX pages. In the page_load method I dynamically create the link buttons as follows ...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
5
by: Tascien | last post by:
I was able to build an asp page dynamically depending on the question that the user answered through the online wizard... I think i can dynamically also create '.vb' or '.aspx' dynamically...
9
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related...
2
by: Jason_SanDiego2006 | last post by:
Hello all, Hang with me, I'm a little new. I'm working on a web application in C# using ASP.NET 2.0 The goal of my application is to have pages whose styles can be dynamically changed based...
16
by: flip2flik | last post by:
Hi. I am using visual web developer express edition and I am using vb.net as the programming language. I want to create a new aspx file on a button click. I will have a template that the new...
0
by: kyungdongkim | last post by:
Hi, I have a dynamically generated MenuStrip following this example: http://www.codeproject.com/useritems/Dynamic_MenuStrip.asp Basically the menu strip allows users to save and load reports. ...
0
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes...
1
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I want to make web site that depends on the information getting by user. For example if the user have four criteria for buying car 4 textbox must be genareted to allow the user to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.