[ Converted Bookmarklet to Chrome Extension not working ]
I have a bookmarklet which would make all hidden input form fields visible. For ease of access for other users I wanted to convert it to a Chrome Extension.
I used http://sandbox.self.li/bookmarklet-to-extension/ to convert but after installing, it does not function.
If someone could please enlighten me as to what is wrong with the following code:
Manifest.json
{
"background": {"scripts": ["background.js"]},
"browser_action": {
"default_icon": "icon-128.png",
"default_title": "WP3"
},
"name": "WP3",
"description": "WP3",
"icons": {
"16": "icon-16.png",
"48": "icon-48.png",
"128": "icon-128.png" },
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
],
"version": "0.1",
"manifest_version": 2
}
Background.js
<script>
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(tab.id, {file: "bookmarklet.js"})
});
</script>
Bookmarket.js
(function(){var is=document.getElementsByTagName("input");for(i=0;i<is.length;i++){if(typeof(is[i].attributes["type"])!="undefined"&&is[i].attributes["type"].value.toLowerCase()=="hidden"){is[i].setAttribute("type","text");is[i].setAttribute("style","background-color:#000000;color:#FFFFFF");}}})();
Answer 1
There is a HTML tag in JavasScript file? That's invalid. Try removing both <script> and </script>. If it won't help, post an error you get in Chrome Web Tools console after chrome action button is clicked.