开发者

Is it possible to add only CSS content_Script so as to not display Permission Warnings

I have created a simple Google chrome extension that overrides CSS classes using the content_scripts field but has no JavaScript. Is there a way to add just the CSS file without my extension requiring data access permission to the matched domain?

Here is my manifest:

{
  "name": "Test Extension",
  "version": "1.0.10",
  "description": "test extension.",
  "content_scripts": [
    {
      "matches": ["https://www.mydomain.com/*"],
      "css": ["main.css"],
      "all_frames": true 
    }
  ]
}

and my main.css

.class1 {width:37em !important;}
.class2 {width:39em !impo开发者_运维技巧rtant;}


There is no way to do that with extensions and if you found a way it should be considered a security issue. This permission warning makes sense if you think about it, since it cannot trully access(read) user data via css but can change it. Consider the following example:

#bankTransactions .fraudAlert {
    display:none;
}

#bankBalance:before {
    content:"US$ 99999";
}

Also, if you just want to restyle some page, I highly recommend this extension.

References:http://code.google.com/chrome/extensions/permission_warnings.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜