473,396 Members | 2,034 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,396 software developers and data experts.

How to check if script has access to properties in another frame/window ?

Hi,

Under the same-origin policy, if a script tries to access properties in
another frame or window that is from another host/protocol/etc, it will
not be allowed by the browser and a permission denied error is given.

I was wondering if anyone knew of a way to check if a particular
frame's or window's properties were accessible before attempting to
access them, to prevent getting the error.

Thanks,

-Adnan.

Jul 23 '05 #1
3 1455
ad******@gmail.com wrote:
[Same Origin Policy]
I was wondering if anyone knew of a way to check if a particular
frame's or window's properties were accessible before attempting to
access them, to prevent getting the error.


That would include checking whether the second-level domain is the same
or not. You could try accessing the `location' property the respective
Window object; that property not subject to the SOP:

<http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/guide/sec.html#1015705>

You could also try exception handling, i.e. access the property and handle
the exception that is thrown if that fails; this will, of course, only
apply to and work in more recent user agents.
PointedEars
Jul 23 '05 #2
Thanks for your reply. I couldn't find any property of location object
that is not subject to SOP. According to the link you sent, properties
'x' and 'y' of location object are not subject to SOP; however, I could
not find any such properties in the location object. Do you know what
the 'x' and 'y' refer to?

Thanks,

-Adnan.

Jul 23 '05 #3
ad******@gmail.com wrote:
Thanks for your reply. I couldn't find any property of location object
that is not subject to SOP.
Yes, but the `location' property value itself is not subject to the SOP,
i.e. access to `foo.location.href' is forbidden but access to `foo.location'
is not.
According to the link you sent, properties 'x' and 'y' of location object
are not subject to SOP; however, I could not find any such properties in
the location object. Do you know what the 'x' and 'y' refer to?


Probably the submit coordinates when input[type="image"] is used.
PointedEars
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir A.C. Doyle's
"The Adventure of the Dancing Men"
Jul 23 '05 #4

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

Similar topics

7
by: Pjotr Wedersteers | last post by:
Sorry to have to ask again, but my ISP's server has some issues I think, almost anything on this ng dating before 12th of this month is no longer available all of a sudden. And I don't think I got...
11
by: Wentink | last post by:
Does anybody have a simple script that let's me popup a picture from a thumbnail? The ones i found are all very very complicated and messy in the source... Thanks, Tintin
2
by: thomas | last post by:
HI I've written a simpole script to open a new window with an image and resize the window depending on the image size: it is function fitToSize() { if( window.document.images )...
6
by: Richard Trahan | last post by:
I want a js function to call a Perl script residing on a server. The Perl script will return a string, to be used by the js. Pseudo code: <script> stringvar = perlfunc_on_server(stringarg)...
1
by: ids | last post by:
I have my own website and i want to use a mouse effect. My problem is that i use frames and when i put the javascript in the index.html like this: <html> <head> <meta name="keywords"...
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
9
by: Viken Karaguesian | last post by:
Hello all, I just discovered this NG, so you'll probably be getting some questions that have been brewing inside me for a while :>) I'm just an amateur who enjoys making websites. I use...
11
by: Rob | last post by:
I know, I know, don't use frames. Well, I'm stuck with these frames and I'm trying to add functionality without a complete redsign. You can look at this as a nostalgic journey. Anyway, I've got...
2
by: jackchang1 | last post by:
Hi, I know if the frames/windows can't access properties inside another frame/window that comes from a different domain. But could this call violate the security window.parent if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
0
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
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
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,...

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.