Everything below works in a Chrome extension but silently fails when ported to Firefox on:
- loading the
test.htmlunless I remove<style></style>from it - appending the
#test_elementto the body
Do styles have to go into a separate file for Firefox extension? Why does append() fail?
test.js
$(document).ready(function() {
$.get(chrome.extension.getURL('/html/test.html'), function(data) {
// not called unless style element is removed from HTML
// and never actually appended if it is removed
$(document.body).append($.parseHTML(data));
});
});
test.html
<style></style>
<div id="test_element">
<p>my name is cow</p>
</div>
manifest.json
{
"manifest_version": 2,
"name": "Test",
"version": "1.0",
"icons": {
"64": "icons/icon-64.png"
},
"permissions": [
"tabs",
"storage",
"idle"
],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["lib/jquery.js", "src/test.js"]
}
],
"web_accessible_resources": [
"html/test.html"
]
}