2014-02-07 1 views
0

jQuery가 iFrame에 다중 도메인 액세스를 허용하지 않는다는 것을 알고 있습니다. 어떻게 든 해결 방법이 있는지 궁금하네요?jQuery 다중 도메인 요소 설정

입력 상자 안의 텍스트를 DB에서 미리 정의 된 사용자 이름으로 설정하려고합니다.

나는 현재이 오류를 받고 있어요 : 해결 방법이있는 경우 https://api.jquery.com/contents/

단순히 궁금 : jQuery의 문서가 명확하게이 .contents() 기능을 사용 불가능 상태로 예상된다

Uncaught SecurityError: Blocked a frame with origin " http://domain.com " from accessing a frame with origin " http://track.domain.com ". Protocols, domains, and ports must match.

어떻게 든 이걸로? 여기

$('#myframe').contents().find('#ext-comp-1001').val('username'); 

이 바이올린입니다 : http://jsfiddle.net/jfreak53/8L2pJ/

답변

1

아니, 당신은 아무것도에 액세스하거나 다른 도메인의 경우 iframe이 내용을 조작 할 수 있습니다. 이것은 iFrame의 목적입니다. w3school

Note: Because of security reasons, the contents of a document can be accessed from another document only if the two documents are located in the same domain.

에서 and this

또한, This SO question 확인