R
R
Roman Rakzin2016-01-17 12:41:54
JavaScript
Roman Rakzin, 2016-01-17 12:41:54

Chrome extension crashes. Scripts don't work. Security policy?

Just started making extensions for Chrome.
The goal is to make a javascript parser.
I want to make a frame in which I will load the page for parsing and I need to access its elements from the main window.
Since you just can’t get through to a frame from another domain because of the security policy, I decided to make an extension.
That's just how to be there with security policies? There are a lot of errors in the console - scripts do not work - in general, something is not right.
Here is the manifest code

{ 
      "name": "myParser", 
      "manifest_version": 2,
      "version": "2.0", 
      "description": "Parser", 
      "permissions": [
         "<all_urls>",
    	 "unlimitedStorage"
       ], 
      "app": {
          "launch": {
             "local_path": "main.html"
          }
       },
       "icons": { 
    	"16": "css/images/Spider-16.png" 
       }
    }

Main.html
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/js/my.js"></script>
    
    <frameset  cols="250,*">
      <frame src="page1.html" name="topFrame"  >
      <frame src="ЗДЕСЬ УРЛ САЙТА,КОТОРЫЙ ПАРСИМ" name="topFrame" scrolling="no"  id="Parseframe">
    </frameset>

I throw a regular alert in my.js and it does not work,
besides that it also writes me various nastiness, such as
Unrecognized Content-Security-Policy directive 'ha256-AJl abracadabra'.
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-AJl abracadabra'), or a nonce ('nonce-...') is required to enable inline execution.
What needs to be written so that at least the basic functionality works?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chromos1985, 2016-02-11
@chromos1985

Try adding sha256-abracadabra to your manifest, unless of course it changes when you restart
Content-Security-Policy: script-src 'sha256-your abracadabra'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question