Error: uncaught exception: Permission denied to get property

OK, I ran into this problem today and luckily Googling answered my question. I thought it would be nice to share :) I was working on a system where I had to open a new window, where the user would select a certain item from a list, and when clicking on that item, the item would be selected in the original window. Problem: I got an error message:

Error: uncaught exception: Permission denied to get property Window.miloform
Now, thanks to the Gecko DOM reference I found the answer to my problem:
I can not access the properties of the new secondary window. I always get a javascript error in the console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>". Why is that? It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Before executing a script, the browser in the main window verifies that the secondary window has the same domain name.
It turns out that the client I am building this for has two domain names, and the new window was opened from a different domain. Yes, that would be a problem, knowing the above.

OK, I ran into this problem today and luckily Googling answered my question. I thought it would be nice to share :) I was working on a system where I had to open a new window, where the user would select a certain item from a list, and when clicking on that item, the item would be selected in the original window. Problem: I got an error message:
Error: uncaught exception: Permission denied to get property Window.miloform
Now, thanks to the Gecko DOM reference I found the answer to my problem:
I can not access the properties of the new secondary window. I always get a javascript error in the console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>". Why is that? It is because of the cross-domain script security restriction (also referred as the "Same Origin Policy"). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Before executing a script, the browser in the main window verifies that the secondary window has the same domain name.
It turns out that the client I am building this for has two domain names, and the new window was opened from a different domain. Yes, that would be a problem, knowing the above.
Add comment

Comments

gravatar Martin Alak: So what is the solution???

Saying that both domains have to be the same is unacceptable. I am trying to write local code (file://) which automates remote pages, and thus both domains cannot be the same.
December 21, 2008
gravatar Observer: from other discusion:
http://www.manticmoo.com/articles/jeff/programming/javascript/enabling-cross-site-reads.php

details:
http://www.mozilla.org/projects/security/components/signed-scripts.html
February 23, 2009
gravatar Diamond Sofa: Excellent article my friend. This is exactly what I've been looking for for quite a time now...
Thanks for this wonderful post! It has been extremely useful. I wish that you will proceed posting your wisdom with us.
February 7, 2012
gravatar ashley furniture: i found your site on msn, thanks for putting up such a beautiful blog.
You completed several good points there. I did looking about the issue and found the majority of people will go along with with all your blog.
February 7, 2012
gravatar Robert Michael Furniture : Its amazing, looking at the time and effort you put into your blog and detailed information you provide. I’ll bookmark your blog and visit it weekly for your new posts.
February 24, 2012
gravatar offset patio umbrella: The information provided in this blog helped me tremendously.Now made it easy for me to understand and implement own concept.
February 24, 2012
gravatar Time Warner Cable Offers: Thanks for sharing. I have enjoyed this post ….
February 24, 2012
gravatar criminal lawyer toronto: An executable is almost always not sufficiently complete for direct execution. Software libraries include collections of functions and functionality that may be embedded in other applications. Operating systems include many standard Software libraries, and applications are often distributed with their own libraries. Thanks.
April 19, 2012

Php5_zce_logo

Upcoming events

I will be speaking 05-06-2012: Forum PHP
I will be attending 06-06-2012: Symfony Live Paris 2012
I will be attending 07-06-2012: Symfony Live Paris 2012
I will be attending 08-06-2012: Symfony Live Paris 2012
I will be attending 09-06-2012: Symfony Live Paris 2012
I will be attending 23-06-2012: PHP TestFest NL

Tags

1337 2008 2010 2011 4developers access modifiers accessibility AdaLovelaceDay09 advent agavi agile alfred amsterdam apache api apple article articles atk atkMetaNode audioscrobbler autoloading automation azure backwards compatibility barcelona barcodes bash bbc bbq beatstad belgium best practices bittorrent blogging blogs boards of canada book books bughuntday bundle caching cake cal evans calendar career cat cerf certificate cfp cilex clear cms cologne common sense communities community components composer conference conferences contest continuous integration contribute contribution crisis css curl custom d-day datetime DbFinderPlugin decorator decorators deployment deps devdays development directoryindex directoryiterator docblox doctrine documentation download dpc dpc09 dpc10 dpc11 DPC2008 dreamhost drupal dv7 eclipse ed editors efficiency enterprise errors event events expertise ezcomponents facebook filter-branch filteriterator finland flickr fork framework frameworks freelance freeze frontend fun game games geoip germany getting real git github globiterator gnome-do google google calendar googletalk graceful degradation hack hackers hidden gem hiphop howto hp HR html http i386 ibuildings icann ide ideasofmarch idm imovie inclusivity indy ingewikkeld integration international php conference internet interview ipad IPC ipc ipc08 ipc10 ipc11se iterators iterm2 javascript jenkins jenkins-php job job openings jobeet john peel joomla joomladays kiva kubuntu launcher launchy left on the web libcurl libraries library lighttpd lime linktuesday linux live london loudblog m2ts mac magazines malware mambo marjolein mediterra meeting meme meta methodology micro-financing microframework microsoft migration movie music mysql namespace namespaces netbeans netherlands newsfire nllgg northeastphp nos odmarco open source opinion ORM osx paradiso paris partnership pavilion pear pecl performance personal pfc10 pfc11 pfcongres pfcongrez pfz photo php PHP php5.3 phpabstract phpazure phpBB phpbb phpbelgium phpbenelux phpbnl10 phpday phpdoc phpdocumentor phpgg phpitalia phpnw phpnw08 phpnw11 phpstorm phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations private projects protected prototype PSR-0 public python qa qr codes re2c recruiting refactoring review rewrite ruby on rails san francisco schedule scifi script security sensio seven things sfdaycgn sflive2011 shell scripting silex simplexml slides smfony software sogeti solar sound speakers spl ssh standard standards star trek static steer strings stylesheets subversion symfony symfony live Symfony2 symfonycamp symfonyday symfonylive symfonyUnderControlPlugin talk talks tech techademy technology techportal tek09 telecommuting terratec terrorism testfest testing textmate textpattern the right tool timeout tips tld todo tomas tools training twig uncon unet usability usergroup validation vhost video vim vinyl virus warp webinar weblogging webservices wiki windows winphp women wordpress work workshop world world of warcraft wpi writing wunderlist xml xpath xsd yara year youtube zc11 ZCE zemanta zend zend framework zend server zend studio zendcon Zend_Form zite
© 2004 - 2012 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Delicious, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.4.0.1