I have an iframe on a subdomain foo.mysite.com. I want to access the contents of a table within the iframe, which has a URL on bar.mysite.com. I can alter foo.mysite.com, but not bar.mysite.com. Hence, I just set document.domain on foo.mysite.com to bar.mysite.com. However, Chrome Developer Tools is still complaining
Uncaught Error: SECURITY_ERR: DOM Exception 18
I suspect that the Same Origin Policy requires both sites to explicitly set the same document.origin value. Is there any way I could temporarily disable XSS checking on Chrome to access the iframe’s elements? I just want to scrape some data from a table in the iframed page using Javascript.
Yes, it’s due to Same Origin Policy. You can disable it for you, but not for others. You must add this argument to chrome shortcut :