Firefox扩展开发人员:在关注此示例时:cross domain content scripts用于访问在localhost上托管的iframe中的维基百科org,它可以正常工作,但在访问https网址时它不会。有效的代码:
$(function(){
$('iframe').each(function() {
try{
console.log(this.contentWindow.location.href);
} catch(e){
console.log(e.message);
}
});
});
package.json:
"permissions": {
"cross-domain-content": ["http://en.m.wikipedia.org/"]
},
但是然后将来自维基百科的localhost html文件中的iframe切换为:
<iframe src="https://maps.google.co.in/maps/ms?ll=19.086522,72.89492&spn=0.001328,0.002642&t=m&z=19&iwloc=0004da9d79b2aac93619b&msa=0&msid=208618496919443620091.0004da9d6f3c4668ebdfa&output=embed"></iframe>
并使用以下方式编辑权限:
"permissions": {
"cross-domain-content": ["https://maps.google.co.in/maps/ms?ll=19.086522,72.89492&spn=0.001328,0.002642&t=m&z=19&iwloc=0004da9d79b2aac93619b&msa=0&msid=208618496919443620091.0004da9d6f3c4668ebdfa&output=embed", "https://maps.google.co.in/","https://maps.google.co.in/maps/ms"]
},
它得到:“拒绝访问属性'href'的权限”