-1
我想爲linkedin求職做一個chrome插件。要運行linkedin javascript api,它需要一個domian,所以爲了開發,我使用了localhost。現在,當點擊Chrome瀏覽器插件時,它會打開一個帶有本地主機url的新選項卡,並使用鏈接的API執行作業搜索。 現在我想讓url頁面在插件的backgrowd中運行以獲取最新的作業更新。但清單不會在後臺加載url頁面。如何在Chrome擴展的後臺運行url
這裏是我的manifest.json
文件
{
"manifest_version": 2,
"name": "Hunt Shire",
"version": "1.0",
"description": "This is a login plugin.",
"background":{
"page": "http://localhost:82/Plugin.html"
},
"browser_action":
{
"defaul_title":"HuntShire",
"default_icon":"Hunt logo.png"
},
"permissions": ["tabs",
"notifications",
"https://platform.linkedin.com/in.js"
],
"web_accessible_resources":["Hunt Logo.png"]
}
反正運行它或任何其他的方式來運行特定域的參考背景腳本。
這是http://localhost:82/Plugin.html
的一些腳本,它用鏈接的API提取數據。
api_key: xxxxxxxxxxx
onLoad: onLinkedInLoad
authorize: true
function onLinkedInLoad() {
IN.Event.on(IN, "auth", onLinkedInAuth);
};
function onLinkedInAuth() {
IN.API.Profile("me").fields(["id", "firstName", "lastName", "emailAddress", "positions:(company)", "following"]).result(displayProfiles);
};
// some more query.
,但如果我這樣做在其他一些本地的HTML文件時,它給我一個錯誤 Uncaught Error: JavaScript API Domain is restricted to localhost
。 請給我一些提示。
謝謝。
取決於API,您可能可以使用Worker來使IO發生並將postMessage結果返回給您的應用程序。 – dandavis
你能否給我解釋一下,如何在後臺運行它。 – shahwarcoder
得到了一個會議,對不起。結賬http://developer.chrome.com/apps/app_external.html大多數我會說的話...... – dandavis