javascript - Using https url with ajax in a Chrome extension popup -


i can't seem find solution anywhere. i'm making chrome extension submitting data service , functionality based on third-party api located on secure url. problem can't https url work , i'm getting error instead:

refused load script 'http://app.something.com/api/v1/idea/create?apikey=...&summary=test&_=1376649061760' because violates following content security policy directive: "script-src 'self' https://app.something.com".

permissions https urls added , content_security_policy defined in manifest.json. although i'm not entirely sure if latter defined correctly.

manifest.json

"permissions": [      "contextmenus",      "tabs",      "storage",      "http://*/*",      "https://*/*",      "<all_urls>"  ],  "content_security_policy": "script-src 'self' https://app.something.com; object-src 'self'", 

popup.js

$('#save').click(function(event) {     event.preventdefault();     var apiurl = 'https://app.something.com/api/v1/idea/create?apikey=';     var apikey = localstorage.getitem('apikey');     var summary = document.getelementbyid('summary');     var title = document.getelementbyid('title');     $.ajax({         url: apiurl + apikey,         type: 'post',         datatype: 'jsonp',         data: (function(title, summary) {           var data = {};           if(title) data["title"] = title;           if(summary) data["summary"] = summary;           return data;         })         ($("#title").val(),$("#summary").val()),         success: function (data) {              ...          } 

popup.html

<form action="" class="apiform" id="api">     <input type="text" id="apikey" placeholder="please enter api key ...">     <button type="submit" id="savekey" form="api" disabled>save</button>     <a class="hint" href="#">need generating api key?</a> </form>  <form action="" class="idea" id="idea">    <p class="label">enter idea summary</p>     <textarea name="summary" id="summary" rows="5" required></textarea>      <p class="label">name idea <span class="hint">(optional)</span></p>     <input type="text" name="title" id="title">      <div class="buttons">         <button type="button" class="secondary" id="cancel">cancel</button>         <button type="submit" class="primary" id="save" disabled>save</button>     </div> </form>  <script src="jquery.min.js"></script> <script src="popup.js"></script>  </body> 

my question is:

can around using $.ajax or there (better) way avoid problem?


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -