google-chrome-extension

JSONP communication in a Google Chrome extension

僤鯓⒐⒋嵵緔 提交于 2020-01-21 18:56:15
问题 I'm writing a Google Chrome extension. I want to use jsonp cross-domain communication with jQuery. Here is the ajax code: $.ajax({ type : 'POST', url : $(this).attr('action'), data : $(this).serialize(), contentType: 'application/json; charset=utf-8', dataType : 'jsonp', success : function() { alert('A'); } }); This calls this URL: http://sgsync.dev.kreatura.hu/api/signup/?callback=jQuery1710883696963544935_1327347078860&nick=&pass=&_=1327347087371 The server answers 200 OK with this data:

JSONP communication in a Google Chrome extension

﹥>﹥吖頭↗ 提交于 2020-01-21 18:54:05
问题 I'm writing a Google Chrome extension. I want to use jsonp cross-domain communication with jQuery. Here is the ajax code: $.ajax({ type : 'POST', url : $(this).attr('action'), data : $(this).serialize(), contentType: 'application/json; charset=utf-8', dataType : 'jsonp', success : function() { alert('A'); } }); This calls this URL: http://sgsync.dev.kreatura.hu/api/signup/?callback=jQuery1710883696963544935_1327347078860&nick=&pass=&_=1327347087371 The server answers 200 OK with this data:

Google Chrome Extension Login Functionality

折月煮酒 提交于 2020-01-21 15:26:13
问题 I am developing a Chrome Extension and I am trying to achieve this: You click on a your chrome extension icon and you're presented with a simple Login page, you type in your credentials and I need to send them to a REST API that has a login method that will return an API key that I will need to store (when I get to that point I will decide where exactly to store it but for the time being it might be in https://developer.chrome.com/extensions/storage ). And afterwards I'd like for the user to

Access-Control-Allow-Origin not checking in chrome extension

主宰稳场 提交于 2020-01-21 09:47:26
问题 As you know, when send $.ajax(..) request to another domain (cross-domain), most browser throw exception like: XMLHttpRequest cannot load http://mysite.com/test.php. Origin http://127.0.0.1:8888 is not allowed by Access-Control-Allow-Origin. I am creating chrome extension and it should send a request to my website. First , i expected to see above message,too. But i confused when i see it worked fine. First, It’s seem good, it’s working and i have what i want. But it can be horrible. Every one

Access extensions in the chrome://extensions page [duplicate]

微笑、不失礼 提交于 2020-01-21 09:06:33
问题 This question already has answers here : Can you access chrome:// pages from an extension? (3 answers) Closed 2 years ago . Here is my mainfest.json : "content_scripts": [ { "all_frames": true, "css": [ "css/event.css" ], "matches": [ "\u003Call_urls>" ], "run_at": "document_start" } but I cannot find content script in the chrome://extensions/ page help!!! 回答1: You can do it on your PC by enabling chrome://flags/#extensions-on-chrome-urls and adding the necessary url, chrome://extensions/ ,

How to get current URL in Chrome on click of the button

核能气质少年 提交于 2020-01-21 08:54:05
问题 I am making an chrome extension that shares url to one website. Now I need a code that can get current URL navigated in browser. When I click on icon I want to open new tab ( http://www.thatsite.com/sharer.php?u= + current URL ). I have two files: manifest.json { "name": "Share on that site", "version": "1", "browser_action": { "default_icon": "icon.png" }, "background": { "scripts": ["background.js"] }, "permissions": ["tabs"], "manifest_version": 2 } and background.js chrome.browserAction

How to get current URL in Chrome on click of the button

ⅰ亾dé卋堺 提交于 2020-01-21 08:54:05
问题 I am making an chrome extension that shares url to one website. Now I need a code that can get current URL navigated in browser. When I click on icon I want to open new tab ( http://www.thatsite.com/sharer.php?u= + current URL ). I have two files: manifest.json { "name": "Share on that site", "version": "1", "browser_action": { "default_icon": "icon.png" }, "background": { "scripts": ["background.js"] }, "permissions": ["tabs"], "manifest_version": 2 } and background.js chrome.browserAction

Where is chrome extension's 'chrome.storage.local' data saved?

若如初见. 提交于 2020-01-21 03:11:40
问题 I can find the previous localStorage api data in ~/.config/google-chrome/Default/Local Storage directory. I see that these are sqlite files which I can browse with sqlite3. However, I'm moving from localStorage api to chrome.storage api and saving the information with chrome.storage.local method. Now, how and where are these files are bing saved in my file system? I can't seem to find any information regarding this in their doc. Any help would be highly appreciated. 回答1: For Windows, you can

How to pass data from content-script to page-level?

前提是你 提交于 2020-01-20 08:42:13
问题 I'm injecting all my js code to front page, but it needs pictures for ui and stuff, that can be imported only with the help of chrome.extension.getUrl and can be called only from content-script, so I've found tons of advices how to pass data to content page, and nothing of about how pass data back, is it possible at all? My code now looks like this: my js code, that will be injected with other code: var Content = {}; $(document).contentReady = function(content) { Content = content; $(document

Is it possible to run a script in context of a webpage, before any of the webpage's scripts run, using a chrome extension?

不羁岁月 提交于 2020-01-20 06:58:28
问题 I have tried "run_at": "document_start" , but there is no DOM when the extension gets control, so I can not insert the script into head . Also, tried to use DOMNodeInserted , but it is not fired for head . if I try to insert the script on first DOMNodeInserted event, it gets executed after the webpage's scripts. 回答1: The root element always exist. You can just append the <script> to the <html> element: var s = document.createElement('script'); s.textContent = 'console.log("Test");'; document