是否可以通过每个iframe通过父页面覆盖“ window.external”方法?
示例
HTML代码Child.html:
<script>
var person = window.external.getInfo("Person.Name");
</script>
HTML代码Parent.html:
<div class="content">
<span>
<div class="content_panel">
<iframe src="Child.html" frameborder="0" scrolling="no" width="100%" marginheight="0" marginwidth="0" id="ScreenWeb" name="ScreenWeb" style="width: 100%;"></iframe>
</div>
</span>
</div>
JavaScript代码Parent.js:
$('#ScreenWeb').attr("src", url).load(function () {
var win = this.contentWindow || this.contentDocument;
win.external.getInfo.prototype = function () {
alert("Unavailable.");
}
});