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

Avoding Cross-Domain Security Error before accessing windowattributes?

Hi,

I have a web application where window A opens window B (same site). B
later wants to do something depending on whether
the window A, window.opener.document.domain, has changed.

However, there doesn't seem to be a way to actually check whether A
has moved to a different domain without triggering (in IE) a security
violation and completely aborting the script. If the user has enabled
debugging, this also brings up an annoying dialog box.

I'd like to either catch this exception somehow or be able to tell
beforehand whether I can access window.opener.* attributes
successfully. According to:

http://msdn.microsoft.com/library/de...g_security.asp

the only thing I can do is to *write* to the various attributes.

Can anyone suggest a way to work around this? I am not interested in
accessing the location/domain of the new page, just whether the window
has left my domain.
--
================================================== =============
<er**********@andreasen.org> Herlev, Denmark
<URL:http://www.andreasen.org/> <*>
================================================== =============

Jul 23 '05 #1
2 6303
It is good that you CANNOT do this.
I think you are trying to spy and police users' movement.
If you want users to stay with your site make it attractive.

Kien

"Erwin S. Andreasen" <er**********@andreasen.org> wrote in message news:<87************@andreasen.org>...
Hi,

I have a web application where window A opens window B (same site). B
later wants to do something depending on whether
the window A, window.opener.document.domain, has changed.

However, there doesn't seem to be a way to actually check whether A
has moved to a different domain without triggering (in IE) a security
violation and completely aborting the script. If the user has enabled
debugging, this also brings up an annoying dialog box.

I'd like to either catch this exception somehow or be able to tell
beforehand whether I can access window.opener.* attributes
successfully. According to:

http://msdn.microsoft.com/library/de...g_security.asp

the only thing I can do is to *write* to the various attributes.

Can anyone suggest a way to work around this? I am not interested in
accessing the location/domain of the new page, just whether the window
has left my domain.

Jul 23 '05 #2


Erwin S. Andreasen wrote:

I have a web application where window A opens window B (same site). B
later wants to do something depending on whether
the window A, window.opener.document.domain, has changed.

However, there doesn't seem to be a way to actually check whether A
has moved to a different domain without triggering (in IE) a security
violation and completely aborting the script. If the user has enabled
debugging, this also brings up an annoying dialog box.


Well by now J(ava)Script supports try/catch, with IE since IE5, with
Netsape since Netscape 6, so at least for those and other new browsers
like Opera 7, Safari you can certainly use
try {
// access other window here
}
catch (e) {
// handle exception here
}

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

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

Similar topics

12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
4
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: jlamanna | last post by:
I was wondering if there was a utility that could tell you when your C# application is making cross-apartment COM calls. I have a fairly large application that makes extensive use of a 3rd party...
1
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I...
6
by: Robert Bravery | last post by:
Hi all, Can some one show me how to achieve a cross product of arrays. So that if I had two arrays (could be any number) with three elements in each (once again could be any number) I would get:...
7
by: Charles | last post by:
I'd like to develop a simple cross-platform application in C++. I'd like it to run in Windows, OS X, PC-BSD and Linux. From my research, it seems I should use Qt or Gtk as a graphical library. Do...
1
by: Otacon22 | last post by:
Hi all, I want to create a robot with a router board based on processor atheros 2.6, called "fonera". I have installed a version of linux, Openwrt and python and i want to use it for some...
3
by: Squat'n Dive | last post by:
Does anyone have an idea why -fno-strict-aliasing is turned off when cross compiling? in configure generated for 2.4.4: case $GCC in yes) # Python violates C99 rules, by casting between...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.