0
jQuery를 사용하여 iframe에서 CSS를 변경하고 싶습니다.CSS를 iframe 오류에서 변경하십시오.
iframe이 :
<iframe id="myiframe" src="https://source.com"></iframe>
jQuery를 : 나는 다음과 같은 코드를 사용
jQuery("#myiframe").contents().find("body").css('background-color', 'black');
을하지만 코드를 실행할 때이있는 다음과 같은 콘솔 오류
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "https://example.com" from accessing a cross-origin frame.
온다 내 문제에 대한 해결책?
가능한 중복 정의를 만들기 위해 예를 들어, 단지 iframe 태그에 대한 오류 SecurityError을 스타일을 적용 할 수 있습니다, 페이지의 일부가 아닙니다 : 원점이있는 프레임이 교차 원점 프레임에 액세스하지 못하도록 차단] (http://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame) –
그래서 iframe에서 CSS를 변경할 수 없습니까? – Badslayer