Using JQuery's post function in chrome extension -


I am trying to post to a local host from within Chrome extensions and it does not seem that.

  {"name": "Send to server", "version": "1.1", "background": "send to server", "server "" "" "" "" "" "," Permissions ": [" Experimental "," Tab "," & lt; all_urls "]," browser_action "" Icon_icon ":" icon.png ", "Default_popup": "popup.html"}, "icon": {"16": "16.png"}, "manifest_version": 2}   

Background html is very short, It only points to "http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" and "background.js". (I use it to include JQuery and be able to use it in background .js. Is there another way to do this?)

background.js: < Pre> Chrome tabs.onUpdated.addListener (SendToServer); The SendToServer function (tabId, changeInfo, tab) {chrome.tabs.get selected (empty, function) (if (changeInfo.status === 'complete') {chrome.experimental.infobars.show ({tabId: tab. Id, path: "infobar.html"}; var strVar = "A page was loaded"; Warning ("before sending:" + strver); $ .post ("http: // localhost / MyDomain", {Var: strvar}, function (strVar) {warning ("sending ...");})}}})}}

Now, warning ("before sending:" + strver); If so, even I am doing well

Any thoughts?

Thank you,

If you debug your background page then you know There is a security error that you are trying to load from javascript to remote source (ajax.googleapis.com), while you have explicitly not allowed in the manifest file. And without jQuery, $ Post can not run. You need to rest the default (make sure to load jQuery on https.)

If in fact, you should actually in this special case, then in your extension JQuery file is included and accordingly load it in backtround.html . Extension is not a website, remote calls take considerable time compared to simple calls. In addition, using remote javascript files makes the extension unusable / unstable when there is no internet connection.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -