OpenWindow.document.write problem

K

kamal

i am facing a strange problem. please help me out with this.

the following code is working perfectly fine in Mozilla Firefox but in
Internet Explorer it is giving an error in the first
OpenWindow.document.write line itself.

function popup_msg_to_all_users() {
var str = "self.close();";
OpenWindow=window.open("hdfkhgkdfhgdfjkg", "newwin",
"height=260, width=360,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Send Message</
TITLE>")
OpenWindow.document.write("<script> function
submitAndClose() { if (!document.frm.title.value) { alert(\'Enter
Title.\'); return false; } else { document.frm.submit();
alert(\'Message Sent.\'); window.close(); }} <\/script>")
OpenWindow.document.write("<BODY bgcolor='#0066cc'>")
OpenWindow.document.write("<tr><td><font size='2'
face='verdana' color='white'><b>Type the message to send to all
syndicates</b></font></td></tr>")
OpenWindow.document.write("<br><textarea STYLE='font-
family: Verdana; font-size: 12px;' cols='50' rows='10' name='txt'>Type
Message Body Here.</textarea>")
OpenWindow.document.write("<input type='hidden'
value='GoSendMessageAllPopup' name='action'>")
OpenWindow.document.write("<input type='hidden' name
='syndicate_id' value='" + synd_id + "'>")
OpenWindow.document.write("<input type='button'
value='Send' name='btn' onClick='javascript: submitAndClose();'>")
OpenWindow.document.write("</form>")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
self.name="main"
}



basically the window is opening up but nothing is displayed inside
it. my IE version is 6.0

thanks in advance
 
M

Martin Honnen

kamal said:
the following code is working perfectly fine in Mozilla Firefox but in
Internet Explorer it is giving an error in the first
OpenWindow.document.write line itself.

Which error exactly do you get?
 
D

Doug Gunnoe

i am facing a strange problem. please help me out with this.

the following code is working perfectly fine in Mozilla Firefox but in
Internet Explorer it is giving an error in the first
OpenWindow.document.write    line itself.

function popup_msg_to_all_users() {
                var str = "self.close();";
                OpenWindow=window.open("hdfkhgkdfhgdfjkg", "newwin",
"height=260, width=360,toolbar=no,scrollbars="+scroll+",menubar=no");
                OpenWindow.document.write("<TITLE>Send Message</
TITLE>")
                OpenWindow.document.write("<script> function
submitAndClose() { if (!document.frm.title.value) { alert(\'Enter
Title.\'); return false; } else { document.frm.submit();
alert(\'Message Sent.\'); window.close(); }} <\/script>")
                OpenWindow.document.write("<BODY bgcolor='#0066cc'>")
                OpenWindow.document.write("<tr><td><font size='2'
face='verdana' color='white'><b>Type the message to send to all
syndicates</b></font></td></tr>")
                OpenWindow.document.write("<br><textarea STYLE='font-
family: Verdana; font-size: 12px;' cols='50' rows='10' name='txt'>Type
Message Body Here.</textarea>")
                OpenWindow.document.write("<input type='hidden'
value='GoSendMessageAllPopup' name='action'>")
                OpenWindow.document.write("<input type='hidden' name
='syndicate_id' value='" + synd_id + "'>")
                OpenWindow.document.write("<input type='button'
value='Send' name='btn' onClick='javascript: submitAndClose();'>")
                OpenWindow.document.write("</form>")
                OpenWindow.document.write("</BODY>")
                OpenWindow.document.write("</HTML>")
                self.name="main"
        }

basically the window is opening up but nothing is displayed inside
it.  my IE version is 6.0

thanks in advance


Do you have a file named 'hdfkhgkdfhgdfjkg' in the same directory? If
not I think this argument should be "".
 
K

kamal

Do you have a file named 'hdfkhgkdfhgdfjkg' in the same directory? If
not I think this argument should be "".


no i dont have that file, so it was showing "page cannot be
displayed". now i have just put a "" and it doesnt show that but
instead it is opening up a blank page. nothing is displayed inside.

after clicking on the exclamation mark at the bottom left side of IE
it opens up an error window to show this:
Line: 1281
char: 3
Error: Access is denied.
Code: 0
URL: <some url>

but this code is working perfectly fine in IE at another place


function popup() {
var str = "self.close();";

OpenWindow=window.open("hdfkhgkdfhgdfjkg", "newwin", "height=350,
width=450,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Send
Message</TITLE>")
//OpenWindow.document.write("<BODY
BGCOLOR=pink>")

OpenWindow.document.write("<script>function submitAndClose()
{ document.frm.submit(); alert(\'Sending Message...\');
window.close(); } <\/script>")
OpenWindow.document.write("<form
action='' name='frm' method='get'><input type='text' value='Enter the
title' name='title'><br>")

OpenWindow.document.write("<tr><td>Type the message to send to all
syndicates</td></tr>")
OpenWindow.document.write("<br><form
action='' name='frm' method='get'><textarea cols='50' rows='10'
value='Enter your text here' name='txt'></textarea>")

// OpenWindow.document.write("<form
action='' name='frm' method='get' '><input type='text' value='Enter
your text here' name='txt'>")

//OpenWindow.document.write("<input
type='hidden' value='Community' name='cat'>")
//OpenWindow.document.write("<input
type='hidden' value='GoSendMessagePopup' name='subcat'>")
OpenWindow.document.write("<input
type='hidden' value='GoSendMessagePopup' name='action'>")
OpenWindow.document.write("<input
type='hidden' name ='syndicate_id' value='##TP_TCL {tpGetVar
syndicate_id}##'>")
OpenWindow.document.write("<input
type='button' value='Send' name='btn' onClick='javascript:
submitAndClose();'>")

OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")

self.name="main"
}


i have included a form element in my original code also but nothing is
displayed on the popup.
 
K

kamal

Which error exactly do you get?

the error which it shows is:

Line: 1281
char: 3
Error: Access is denied.
Code: 0
URL: <some url>

when i click on the exclamation mark at the bottom left corner of IE
 
V

VK

i am facing a strange problem. please help me out with this.

the following code is working perfectly fine in Mozilla Firefox but in
Internet Explorer it is giving an error in the first
OpenWindow.document.write line itself.

function popup_msg_to_all_users() {
var str = "self.close();";
OpenWindow=window.open("hdfkhgkdfhgdfjkg", "newwin",

What URL is "hdfkhgkdfhgdfjkg" by your opinion? If it's really what
you are having in your code then such cheat codes are not allowed
anymore in IE6 with security fix and IE7. They are treated as an
attempt to escape from zone security rules. For a while you may use
"about:blank" for URL instead but this will be sized as well with new
fixes installed. So I suggest to everyone to start switching to the
only working old schema:

function popup_msg_IE() {
if (window.open instanceof Object) {
// window.open method is maskoned
// by popup blocking plugin
// your alt actions
}
else {
window.open('real_URL.html','popup',params);
}
}

where real_URL.html is a real page within the same domain.

That naturally means that one cannot open popup and interact with it
right away. One must open popup and then either check the
interactivity via setTimeout calls or via event handlers.

As soon as the interactivity confirmed one may go with the stage 2
(write to popup, call its methods and property etc.)

It is not of course a plain vanilla dumpster as was initially intended
but it has one huge benefit: it (still) works for modern browsers.

On the long run window.open and popup are extinguishing tools in the
Web. While for intranet solutions with custom security settings they
remain usable, for open WWW their usability is getting and nearly
became negligible because of numerous secury and ads protection
features.
This way for a fresh project it is suggested to forget window.open as
if it did not exist at all: rather than keep discovering that your
solution is not workable here or there.
 
T

Thomas 'PointedEars' Lahn

kamal said:
i am facing a strange problem. please help me out with this.

the following code is working perfectly fine in Mozilla Firefox but in
Internet Explorer it is giving an error in the first
OpenWindow.document.write line itself.

function popup_msg_to_all_users() {
var str = "self.close();";
OpenWindow=window.open("hdfkhgkdfhgdfjkg", "newwin",

There is no point in using an arbitrary non-existing URI reference like
"hdfkhgkdfhgdfjkg". The empty string will suffice.
"height=260, width=360,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Send Message</ ^^
TITLE>")
OpenWindow.document.write("<script> function ^^^^^^^^
submitAndClose() { if (!document.frm.title.value) { alert(\'Enter
[...]
basically the window is opening up but nothing is displayed inside
it. my IE version is 6.0

Start using Valid (and easily legible) HTML for your generator code and also
generate Valid (and legible) HTML, and your no-so-strange problems will go away.

http://validator.w3.org/


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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top