사실, 컨테이너 창에 의해 실행되는 JavaScript는 iframe >에있는 문서의 DOM을 조작 할 수 있습니다. 예를 들어이 페이지의 버튼을 클릭하면 문서의 <iframe>에 Google 검색 버튼이 표시되지 않습니다. JS가 신속하고 더러운 것을 참고, 나는 단지 사파리를 사용하여 테스트했습니다
컨테이너 HTML을 : 모두 인터넷 익스플로러와 파이어 폭스에서 작동하지
<html>
<head>
<title>Container</title>
<script type="text/javascript">
onload = function() {
// Listen for a click on the 'remover' button.
var oRemover = document.getElementById('remover');
oRemover.onclick = hideGoogleSearchButton;
}
var hideGoogleSearchButton = function() {
var oInnerDoc = document.getElementById('google_frame').contentDocument;
var aForms = oInnerDoc.getElementsByTagName('form');
var oButton = aForms[0].elements['btnG'];
oButton.style.display = 'none';
}
</script>
</head>
<body>
<button id="remover">Hide 'Google Search' button inside the iframe</button>:
<iframe src="http://www.google.com/" id="google_frame" />
</body>
</html>
흠. 이 모양은 Safari에서만 작동하며 교차 도메인 보안 버그로 간주 될 수 있습니다. –