0

I am trying to make a extension that when i click extension icon it will show me a simple popup . in popup html i have few link with radio button. it should work when i click on radio button it will redirect the link.

<html>
    <head>
<script>
function OpenWindow(){
    for(i=0;i<document.FormLink["RB1"].length;i++){
      if(document.FormLink["RB1"][i].checked){
    window.open(document.FormLink["RB1"][i].value);
    break;
  }
}
  }
<script>
    </head>
    <body>
    <input type="radio" onchange="window.location.replace('https://google.com.com')">Google<br/>
<input type="radio" onchange="window.location.replace('https://bing.com')">Bing<br/>
<form name="FormLink">
<input type="radio" name="RB1" value="https://yahoo.com">Yahoo!<br/>
<input type="radio" name="RB1" value="https://yahoo.com">None!<br/>
<form>

        <body>
        </html>

I save this as popup.html

i want to run it through chrome extension but i found error it shows me

Refused to execute inline script because of Content-Security-Policy

my menifest.json file

"background": {
      "persistent": false,
      "scripts": [ "background.js" ]
   },
   "browser_action": {
      "default_icon": "icon.png",
      "default_popup": "popup.html"
   },
"manifest_version": 2,
   "name": "My Extension",
   "permissions": [ "tabs","<all_urls>" ],

How can i solve my problem. it will be better for me if anybody can give me some correct code that will run as i want in my extension

Xan
  • 66,873
  • 13
  • 150
  • 174
  • 1
    Exactly as it says, don't use inline scripts, make a separate popup.js with [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener). – wOxxOm Aug 23 '15 at 11:43
  • See duplicate, with `onchange` instead of `onclick` – Xan Aug 24 '15 at 11:51
  • thank you for your answer.. can you provide me the code of popup.js regarding this code ? .. it will help me please.. – Bolaram Paul Aug 24 '15 at 19:07

0 Answers0