473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a new Explorer Window by passing HTML

I currently have this code:

<script language="javascript">
function init()
{
// load XML source document
var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
source.async = false;
source.load("record49a36bde.xml");

// load XSLT stylesheet document
var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
stylesheet.async = false;
stylesheet.load("detail_view.xsl");

// transform the source using the XSLT stylesheet
target.innerHTML = source.transformNode(stylesheet);
}
</script>
I then need to be able send the html stored in 'target' to a new
explorer window.

Is this possible?

Thanks

Apr 25 '06 #1
4 2073

"Casper" <ma**************@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I currently have this code:

<script language="javascript">
function init()
{
// load XML source document
var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
source.async = false;
source.load("record49a36bde.xml");

// load XSLT stylesheet document
var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
stylesheet.async = false;
stylesheet.load("detail_view.xsl");

// transform the source using the XSLT stylesheet
target.innerHTML = source.transformNode(stylesheet);
}
</script>
I then need to be able send the html stored in 'target' to a new
explorer window.

Is this possible?


Something like :-

var newWindow = window.open();
newWindow.document.innerHTML = target.innerHTML;

or some variation may possibly work.

Aaron
Apr 27 '06 #2
>
var newWindow = window.open();
newWindow.document.innerHTML = target.innerHTML;


"document" doesn't nave "innerHTML" property, use "write()" method
instead of.

newWindow.document.write(target.innerHTML);

Apr 28 '06 #3
marss wrote:
var newWindow = window.open();
newWindow.document.innerHTML = target.innerHTML;

Please provide attribution of quoted material.

<URL:http://jibbering.com/faq/faq_notes/pots1.html>
<URL:http://www.safalra.com/special/googlegroupsreply/>
"document" doesn't nave "innerHTML" property, use "write()" method
instead of.

newWindow.document.write(target.innerHTML);


It will not work, because the `innerHTML' property of any DOM object will
always only evaluate to the code of the content, not to the code of the
container. Therefore, one has to write at least:

var newWindow = window.open();
if (newWindow && newWindow.document)
{
newWindow.document.open();
newWindow.document.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
+ ' "http://www.w3.org/TR/html4/loose.dtd">'
+ '<html>'
+ target.innerHTML;
+ '<\/html>');
newWindow.document.close();
}

Since the `outerHTML' property has no broad support, there is an inevitable
loss of information to this approach.
PointedEars
--
There are two possibilities: Either we are alone in the
universe or we are not. Both are equally terrifying.
-- Arthur C. Clarke
Apr 28 '06 #4
Thomas 'PointedEars' Lahn said the following on 4/28/2006 5:04 AM:
marss wrote:
var newWindow = window.open();
newWindow.document.innerHTML = target.innerHTML;
Please provide attribution of quoted material.

<URL:http://jibbering.com/faq/faq_notes/pots1.html>
Solid reference but at a minimum point a person to the relevant spot in
that document:

<URL: http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>

covers quoting/attributing.
<URL:http://www.safalra.com/special/googlegroupsreply/>
Irrelevant to the post you replied to.
"document" doesn't nave "innerHTML" property, use "write()" method
instead of.

newWindow.document.write(target.innerHTML);


It will not work, because the `innerHTML' property of any DOM object will
always only evaluate to the code of the content, not to the code of the
container. Therefore, one has to write at least:


That does not, at a minimum, satisfy the needs.
var newWindow = window.open();
if (newWindow && newWindow.document)


No test to see if the window was closed by a popup blocker?

Nor does the code do anything with Symantec popup blocking code.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 30 '06 #5

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

Similar topics

2
1296
by: SROSeaner | last post by:
I am seeking to create a new internet explorer window with certain dimensions and a position on screen. Also, I have a couple of arrays containing data I want to send to that new window. I have...
22
3099
by: Tom Moroow | last post by:
Hi, I'm pretty new to javascript and was wondering how you would piece together a variable name and then assign it a value. I want to create a hidden field and assign it a value based on the value...
5
5055
by: Nicola Pedrozzi | last post by:
Here I really need a guru... ;^( I found out today with a big disappointment that : window.open("url", ...) and also navigate("url") limit the max length of the url string to something...
4
4643
by: Pasquale | last post by:
Hello, I wondering if there is a way to dynamically update a select list with javascript from a database query without having to reload the page to update the list?
8
1841
by: David W. Simmonds | last post by:
Is there an easy way to create a new browser window from C# and ASP.NET? I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res...
6
2880
by: Sandy | last post by:
Hello - I have a little application that I would like to have an exit button on that closes my web application and closes Internet Explorer. What is the code that will do that? Any help...
6
7238
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
4
4710
by: Ryan Knopp | last post by:
This is an update from a previous post, I just simplified the code. It seems that I can't get the image map to work with IE7. The page is located here http://www.theknopps.com/test.html and the...
2
3129
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.