Commit Graph

11 Commits

Author SHA1 Message Date
Aad Versteden
4cddd8497c Use URL interface in apply-css example
By using the URL interface, the user is ascertained that the piece of
code does not manipulate the DOM.  Keeping them in the right mental
context for the example.

The apply-css example uses the protocol of the URL of the tab to
determine if a pageAction should be shown.  Any page that is hosted
over http or https will receive the page action.

The former implementation creates an anchor tag, assigns the URL to
that, and fetches the protocol from there.  This PR alters that to
using the URL interface.  This makes it clear to the user that we're
staying in JavaScript land and will not start manipulating the visible
DOM.  I would argue this is cleaner all together, but I'm very open to
learning about a different opinion.

The URL interface is more broadly supported than the
pageAction.setIcon which this example is also dependent on, so this
change should not change compatibility of this Browser Extension.
2020-12-31 10:36:57 +01:00
YFdyh000
0a745348f3 Fixes for ESLint 2017-07-09 05:55:13 +08:00
wbamberg
dd22610f92 Add note about content scripts not working om the AMO site (#160)
Fix for https://github.com/mdn/webextensions-examples/issues/120.
2016-12-12 11:02:16 -08:00
wbamberg
587ecfc504 Remove applications key wherever possible (#144) 2016-11-18 14:14:25 -08:00
wbamberg
c5d69d15d6 Rewrite examples to use browser.* and promises (#138) 2016-11-15 10:12:55 -08:00
Kumar McMillan
0636827269 Link to what a page action is 2016-10-13 14:18:33 -05:00
Makyen
b3e519e110 Change apply-css icon color to red (matches border and is visible in Developer Edition) 2016-08-24 16:46:32 -07:00
Makyen
f6068c9a06 Change apply-css icon color to red (matches border and is visible in Developer Edition) 2016-08-24 16:45:39 -07:00
Will Bamberg
9e6945676c Update based review comments, and show action only in http(s) pages 2016-08-17 15:54:02 -07:00
Will Bamberg
c3eff787af Added comments to apply-css/background.js 2016-08-17 11:24:35 -07:00
Will Bamberg
c4b5b841f1 New example, showing insertCSS and removeCSS 2016-08-17 11:21:30 -07:00