-1

I want to access Popup function(child). but Their domain is different! Error code is below

Uncaught DOMException: Blocked a frame with origin "xxxx.xxxx.xxx" from accessing a cross-origin frame.

I try remove subdomain. and access popup fuction.

document.domain="xxxx.kr";

i Know / Can do this!

but Now Their domain is only different!!

How can I solve this problem?

Questions is below! 1. I want to Access Pop Up(different domain) function!

  • Possible duplicate of [SecurityError: Blocked a frame with origin from accessing a cross-origin frame](http://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame) – Daniel Bernsons Mar 16 '17 at 04:44

1 Answers1

1
  • Cross-site scripting is not allowed in most browsers.

Communicate with the other window via cross-document messaging described here: https://developer.mozilla.org/en/DOM/window.postMessage

The Window.postMessage() method safely enables cross-origin communication. Normally, scripts on different pages are allowed to access each other if and only if the pages that executed them are at locations with the same protocol (usually both https), port number (443 being the default for https), and host (modulo Document.domain being set by both pages to the same value). window.postMessage() provides a controlled mechanism to circumvent this restriction in a way which is secure when properly used.

Anant Dabhi
  • 9,506
  • 2
  • 28
  • 48