473,394 Members | 1,718 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,394 software developers and data experts.

Spurious security error when accessing pop-up data


My code is generating this type of error:

Security Error: Content at http://nonexistent.org/somepage.html
may not load data from about:blank.

The "about:blank" page mentioned in the error message is a pop-up
window, whose content is 100% dynamically-generated, and which is
in fact *owes its existence* to code in the referring page
(nonexistent.org/somepage.html), along the lines of something like

window.open("", "pop-up", "width=450,height=300,resizable");

So, AFAICT, the error is spurious (i.e. there's really no security
breach). Is there any way to inform the browser that "about:blank"
does belong to nonexistent.org?

Thanks!

Karl
--
Sent from a spam-bucket account; I check it once in a blue moon. If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.
Jul 23 '05 #1
4 2268
KKramsch wrote:
My code is generating this type of error:

Security Error: Content at http://nonexistent.org/somepage.html
may not load data from about:blank.

The "about:blank" page mentioned in the error message is a pop-up
window, whose content is 100% dynamically-generated, and which is
in fact *owes its existence* to code in the referring page
(nonexistent.org/somepage.html), along the lines of something like

window.open("", "pop-up", "width=450,height=300,resizable");

So, AFAICT, the error is spurious (i.e. there's really no security
breach). Is there any way to inform the browser that "about:blank"
does belong to nonexistent.org?

Thanks!

Karl


about:blank and any page loaded from your domain are indeed from
completely different domains, and should not be able to modify each
others' content.

Just use:

window.open("blank.htm" ...);

and in blank.htm:

<html>
<head>
<title>blank.htm</title>
</head>
<body onload="if (opener && opener.callBack) opener.callBack();">
</body>
</html>

Now the document in the newly opened window has also originated from
your domain. Also, you now have a way to trigger a script in the opener
once you are sure the new document has completely loaded (and there is
in fact a document object in the new window to be manipulated).

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
In <40***************@agricoreunited.com> Grant Wagner <gw*****@agricoreunited.com> writes:
KKramsch wrote:
My code is generating this type of error:

Security Error: Content at http://nonexistent.org/somepage.html
may not load data from about:blank.

The "about:blank" page mentioned in the error message is a pop-up
window, whose content is 100% dynamically-generated, and which is
in fact *owes its existence* to code in the referring page
(nonexistent.org/somepage.html), along the lines of something like

window.open("", "pop-up", "width=450,height=300,resizable");

So, AFAICT, the error is spurious (i.e. there's really no security
breach). Is there any way to inform the browser that "about:blank"
does belong to nonexistent.org?

Thanks!

Karl

about:blank and any page loaded from your domain are indeed from
completely different domains, and should not be able to modify each
others' content. Just use: window.open("blank.htm" ...); and in blank.htm: <html>
<head>
<title>blank.htm</title>
</head>
<body onload="if (opener && opener.callBack) opener.callBack();">
</body>
</html>


Hi! Thanks! But isn't there a way to do this without requiring
a dummy blank.htm file being physically on the disk?

Karl

--
Sent from a spam-bucket account; I check it once in a blue moon. If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.
Jul 23 '05 #3
In <cd**********@reader2.panix.com> KKramsch <ka*******************@yahooPERIODcom.invalid> writes:
In <40***************@agricoreunited.com> Grant Wagner <gw*****@agricoreunited.com> writes:
KKramsch wrote:
My code is generating this type of error:

Security Error: Content at http://nonexistent.org/somepage.html
may not load data from about:blank.

The "about:blank" page mentioned in the error message is a pop-up
window, whose content is 100% dynamically-generated, and which is
in fact *owes its existence* to code in the referring page
(nonexistent.org/somepage.html), along the lines of something like

window.open("", "pop-up", "width=450,height=300,resizable");

So, AFAICT, the error is spurious (i.e. there's really no security
breach). Is there any way to inform the browser that "about:blank"
does belong to nonexistent.org?

Thanks!

Karl
about:blank and any page loaded from your domain are indeed from
completely different domains, and should not be able to modify each
others' content. Just use: window.open("blank.htm" ...); and in blank.htm: <html>
<head>
<title>blank.htm</title>
</head>
<body onload="if (opener && opener.callBack) opener.callBack();">
</body>
</html>

Hi! Thanks! But isn't there a way to do this without requiring
a dummy blank.htm file being physically on the disk?


After my last post it occurred to me that it would be better to
post more code. The code in question belongs to a utilities
JavaScript "module" for use by all my CGI scripts; it includes the
following methods (error occurs in the console() method):

var Console;

function maybe_open_console() {
if (!Console || Console.closed) {
Console = window.open("","console","width=600,height=300,res izable");
}
try {
return Console.document && Console.document.open;
}
catch (ex) { return false; }
}

function console(msg) {
if (maybe_open_console()) {
var d = Console.document;

// The next line of code causes the security error
d.open("text/plain");

d.write(msg);
d.close();
}
}
The console() method is to be used for debugging purposes. It
pops up a window if necessary and writes a message to it. I have
indicated the line in it that causes the error.

Since I want this method to be usable by any CGI script, I'd like
to minimize dependencies on other files (such as a dummmy blank.htm
file somewhere below docroot).

Any suggestions on how to implement this would be much appreciated!

Karl

--
Sent from a spam-bucket account; I check it once in a blue moon. If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.
Jul 23 '05 #4
KKramsch wrote:
In <40***************@agricoreunited.com> Grant Wagner <gw*****@agricoreunited.com> writes:
about:blank and any page loaded from your domain are indeed from
completely different domains, and should not be able to modify each
others' content.

Just use:

window.open("blank.htm" ...);

and in blank.htm:

<html>
<head>
<title>blank.htm</title>
</head>
<body onload="if (opener && opener.callBack) opener.callBack();">
</body>
</html>


Hi! Thanks! But isn't there a way to do this without requiring
a dummy blank.htm file being physically on the disk?


<script type="text/javascript">
var Console;
function console(msg) {
var content = '<html>' +
'<head>' +
'<title>Console</title>' +
'</head>' +
'<body>' + '<pre>' +
msg +
'</pre>' + '</body>' +
'</html>';
if (!Console || Console.closed) {
Console = window.open(
"javascript:'" + content + "'",
"console",
"width=600,height=300,resizable"
);
} else {
Console.document.open();
Console.document.write(content);
Console.document.close();
Console.focus();
}
}
</script>
<a href="#" onclick="console('hi there');return false;">Click this first</a>
<br>
<a href="#" onclick="console('already open');return false;">Click this second *before* closing
the console window</a>

Tested and working in: IE6SP1, Netscape 4.78, Firefox 0.9.2 and Mozilla 1.7.1

In Opera 7.52, you get:
Event thread: onclick
Error:
name: ReferenceError
message: Security error: attempted to read protected variable

on the second call to console(). Uncommenting the alert() reveals that Console is "object
inaccessible".

The fact that it works in Firefox and Mozilla tells me that either it's one of the following:
a) an overly zealous security model in Opera b) a bug in Opera c) a bug in the security model
of Gecko and what I'm doing really shouldn't be allowed.

I'm guessing (and hoping) it's a) or b).

It doesn't work at all in Opera 6.05.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #5

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

Similar topics

0
by: Ger | last post by:
Hi, I have a problem with a Windows Service that I have created accessing System.Management.dll on a W2k3 environment. The Service runs fine on an XP machine but the same Service causes an error...
5
by: Nathan Bloom | last post by:
Hi, I have a secured database that runs fine on the computer the database is installed on. I have several workstations with access runtime installed that also need access to the database. ...
44
by: Mohanasundaram | last post by:
int i = 10; int main() { int i = 20; return 0; } Hi All, I want to access the global variable i inside the main. Is there
0
by: raagzcd | last post by:
Hi, I have deployed an ASP.NET application on windows 2003 server. It uses windows authentication .In the code i am using the following code to identify the corpid of the logged in user. ...
1
by: Dave | last post by:
I am getting te following error in a ASP.Net app that is running on Win XP Pro (SP2): Server cannot access application directory 'C:\Documents and Settings\dave\My Documents\My Visual Studio...
2
by: Mike W | last post by:
VB .NET 2003: When I click on the Start button (>) in Visual Studio to run my project, I get several messages in the Task List window. The first says: C:\code\CaliberGenerator\Inherited...
0
by: Mike W | last post by:
VB .NET 2003: When I click on the Start button (>) in Visual Studio to run my project, I get several messages in the Task List window. The first says: C:\code\CaliberGenerator\Inherited...
4
by: Adrian | last post by:
Hi I'm trying to write an ActiveX replacement in VB.Net the following link was my starting point. http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp All was going well until I tried...
10
by: Richard MSL | last post by:
I am having problems working with .net security. I have been attempting to use the Microsoft .Net Framework 2.0 Configuration tool (version 2.0.50727.42), but it won't work for me. I have a simple...
3
by: cityzen.2000 | last post by:
Hello all I have a web page that has a bunch of links implemented in Javascript, each of which calls back to the code-behind page via a Webform_DoCallback call. My problem is this: When I am...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...
0
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...

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.