我正在尝试找出子窗口中的父窗口使用的协议。如果我使用window.opener.location.protocol,它可以在除Opera之外的所有应用程序(IE8、FF3.5.5、Safari4.0.3、Chrome4)中运行。在歌剧中,我得到了:
message: Security error: attempted to read protected variable 'protocol'这曾经在Opera中工作得很好,但我猜他们改变了它。我使用的是Opera10.10。有没有办法测试协议,甚至确定父窗口与子窗口的位置和协议是否相同?
发布于 2009-12-07 22:22:20
只有在协议不同时才会出现错误。
换句话说:
var isParentSecure;
try {
isParentSecure = window.opener.location.protocol === 'https';
catch(e) { isParentSecure = window.location.protocol !== 'https'; }我还没有真正测试过这个。
https://stackoverflow.com/questions/1860190
复制相似问题