- 13
- Hanam09
- 조회 수 394
Parent page에서 다른 도메인 아이프레임 page의 요소를 (element)를 가져오려 하는데 이런 오류가 발생합니다.
Uncaught DOMException: Blocked a frame with origin "http://note.nemodev.kr" from accessing a cross-origin frame.
(주소에 신경쓰면 지는거다.)
이걸 우회하고 요소를 구할 수 있나요?
작성자
댓글 13
![profile image](/files/member_extra_info/profile_image/640/096/96640.gif?t=1548527149)
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/840/162/162840.png?t=1497669415)
아니오 그저 다른 주소의 iframe 의 요소를 구하면 저렇게 뜹니다.
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![title : 황금 서버 (30일) title: 황금 서버 (30일)](https://studyforus.com/./files/iconshop/33055af84f02ddedb19db038cdae0d2f.gif)
![profile image](/files/member_extra_info/profile_image/569/001/1569.png?t=1527385219)
당연히 에러가 나는게 맞습니다...
저런 식으로 접근이 가능해지면 보안에 취약해지기 때문입니다...
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/145/220/220145.jpg?t=1603012768)
크흠...ㅋㅋㅋㅋ
우회하기 어려울겁니다. 브라우저에서 원천 봉쇄를 해놓기 때문에....
도메인이 다른 프레임의 요소는 접근할 수 없어요.
postMessage를 사용하면 통신정도는 가능하겠지만요.
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/840/162/162840.png?t=1497669415)
문제는 상대쪽에서 postMessage 를 받고 리턴할 수 있어야 하는데 제가 youtube 에서 긇어오는지라.
어떻게 chrome 확장 프로그렘을 사용해서 안될까요?
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/840/162/162840.png?t=1497669415)
CSP를 완화하여도 도움이 되지 않습니다.
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![title : 황금 서버 (30일) title: 황금 서버 (30일)](https://studyforus.com/./files/iconshop/33055af84f02ddedb19db038cdae0d2f.gif)
![profile image](/files/member_extra_info/profile_image/569/001/1569.png?t=1527385219)
크롬 확장 프로그램을 이용한다면 iframe에 있는 내용을 수정하거나 가져오는 것이 가능합니다.
https://stackoverflow.com/questions/11325415/access-iframe-content-from-a-chromes-extension-content-script
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/840/162/162840.png?t=1497669415)
오오ㅗ오오오오오오ㅗ옹오오오
감사합니다;;;;;;^^;;
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/145/220/220145.jpg?t=1603012768)
긁어오는 용도라면 PHP로 긁어온 다음에 Ajax로 웹상에서 읽으면 되지 않을까요?
유튜브는 Iframe API를 제공해서 그걸 쓰시는게 빠를거구요.
확장 프로그램을 쓰는거면 문제될 건 없습니다만, 외부인이 이용하기에는 쉽지 않을건데요?
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/840/162/162840.png?t=1497669415)
해결하였습니다.
PostMessage 를 사용하여 Video Element에 직접 명령을 내리는 방식으로.
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/900/244/244900.png?t=1509196381)
오호오호 humit 님 감사합니다. 스크랩 해갈 께요ㅎㅎ
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![title : 황금 서버 (30일) title: 황금 서버 (30일)](https://studyforus.com/./files/iconshop/33055af84f02ddedb19db038cdae0d2f.gif)
![profile image](/files/member_extra_info/profile_image/569/001/1569.png?t=1527385219)
여기 주소를 출처로 하지 마시고 댓글로 달아놓은 URL을 출처로 해주시면 될 것 같습니다 ㅎ
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
![profile image](/files/member_extra_info/profile_image/900/244/244900.png?t=1509196381)
네네 감사합니다
![comment menu](/modules/board/skins/comely_board/images/icn_more.png)
혹시 frame 을 사용하여 웹페이지를 구성하셨나요?