Is-it possible to write in a mother window from a child window ?

O

orion30

Is-it possible to write in a mother window from a child window ?
Like this:
Parent.document.write(............................................)
 
G

Grant Wagner

orion30 said:
Is-it possible to write in a mother window from a child window ?
Like this:
Parent.document.write(............................................)

Why not try it and report back to us whether it worked or not?

<script type="text/javascript">
window.newWindowHtml = [
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
'<html>',
'<head>',
'<title>Test Window</title>',
'</head>',
'<body onload="opener.document.write(\'hi there\');">',
'</body>',
'</html>'
].join('\n');
window.open('javascript:eek:pener.newWindowHtml');
</script>

Apparently it does work.
 
T

Thomas 'PointedEars' Lahn

Grant said:
<script type="text/javascript">
window.newWindowHtml = [
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
'<html>',
'<head>',
'<title>Test Window</title>',
'</head>',
'<body onload="opener.document.write(\'hi there\');">',
'</body>',
'</html>'
].join('\n');
window.open('javascript:eek:pener.newWindowHtml');
</script>

Apparently it does work.

However it should not :) You forgot to escape the ETAGO delimiters, hence
it is not Valid HTML. And one also should specify the system identifier
in a DOCTYPE declaration rather than either assuming the UA will use a
reference file or force it into Quirks/Compatibility Mode. It would be
also useful to specify the default scripting language for event handler
attributes no matter if some UAs tested with do not care about that.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top