Reputation: 75
I developed manifest version 1 of a chrome extension which takes input from user and open a new window
But when I upgraded to manifest version 2 the redirection to www.someUrl.com in a new tab is stopped.
Please tell me what changes I have to do according to version 2 to make it run.
popup.html
<body onload="document.form.query.focus()";>
<div id="searchwrapper">
<script>
function send_url() {
var url = "www.someurl.com?query="+form.query.value;
window.open(url, '_blank');
return false;
}
</script>
<form name="form" id="search_form" action="popup.html" method="POST">
<input type="text" class="searchbox" name="query" value=""/>
<input type="hidden" name="search" value="1">
<input type="image" src="search.png" onClick="send_url()" value=""/>
</form>
</div>
</body>
and my manifest.json
{
"manifest_version": 2,
"name": "Search",
"version": "2.0",
"description": "This is a chrome extension for search",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": ["www.someUrl.com"]
}
Upvotes: 1
Views: 3631
Reputation: 36
No inline scripts is allowed in Manifest2. Manifest 2 also disallow
onClick="send_url()"
Upvotes: 2