firefox扩展跨域iframe https

时间:2015-01-24 21:40:00

标签: firefox iframe cross-domain firefox-addon-sdk

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&amp;spn=0.001328,0.002642&amp;t=m&amp;z=19&amp;iwloc=0004da9d79b2aac93619b&amp;msa=0&amp;msid=208618496919443620091.0004da9d6f3c4668ebdfa&output=embed"></iframe>

并使用以下方式编辑权限:

 "permissions": {
   "cross-domain-content": ["https://maps.google.co.in/maps/ms?ll=19.086522,72.89492&amp;spn=0.001328,0.002642&amp;t=m&amp;z=19&amp;iwloc=0004da9d79b2aac93619b&amp;msa=0&amp;msid=208618496919443620091.0004da9d6f3c4668ebdfa&output=embed", "https://maps.google.co.in/","https://maps.google.co.in/maps/ms"]

},

它得到:“拒绝访问属性'href'的权限”

0 个答案:

没有答案