google-chrome-extension

Detecting the current IP through chrome extension?

孤街醉人 提交于 2019-12-30 11:13:08
问题 My Chrome extention needs to know what is the IP of the machine that it is running on (the real world IP) Is there a easy way of doing it? 回答1: You could always use the freegeoip service, one of my favorite implementations to pull it in is as follows: var geoip = function(data){ if (data.region_name.length > 0) { console.log('Your external IP:', data.ip); } } var el = document.createElement('script'); el.src = 'http://freegeoip.net/json/?callback=geoip'; document.body.appendChild(el); 回答2:

Log in to a Chrome app or extension

耗尽温柔 提交于 2019-12-30 11:12:20
问题 How would I go about creating an auth system requiring a user to log in to a Chrome app or extension via my own service? A good example is the TweetDeck app, where the user can log in completely within the app with no need to visit an external website. 回答1: Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account. If your app uses its own server to authenticate users, you

Google Chrome Extension Http request

孤者浪人 提交于 2019-12-30 11:10:54
问题 I'd like to know if Google Chrome Extension can make a HTTP request and parse the body of the result (like Curl). For example, there is a server 1.2.3.4 that answers the question ?a=1&b=2 by summarizing the URL parameters. The query "http://1.2.3.4?a=1&b=2" would return a body containing 3 , and my extension wants to submit such a query and parse the result. Any help would be appreciated. 回答1: Yes, using Cross-Origin XMLHttpRequest. Set the permissions in the manifest and use it like var xhr

How do I make a Chrome extension's window blink in the taskbar?

倖福魔咒の 提交于 2019-12-30 10:12:31
问题 I've noticed there are some applications that can make the window in the taskbar blink using a chrome extension? Similar to how chrome will show a green progress bar when downloading something, other windows will blink orange to get your attention. Is there anyway to get a chrome extension to do this? 回答1: Yes, it's possible with the windows API: drawAttention If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused

Chrome Native messaging with PHP

本秂侑毒 提交于 2019-12-30 09:48:10
问题 I am trying to build a PHP class that can communicate with a Chrome Extention through Native Messaging. I can connect to my code, but at initiation Chrome sends chrome-extension://lkjcciocnocjjgpacggbaikjehbfedbl/ --parent-window=1837060 To my PHP console app ( The Host) . What do I reply to make the connection working? Below my PHP code. Yes its dirty because its a POC project and I am very new to Chrome Extensions especially with the current updates. function out($data = ""){ $fp = fopen(

Event pages and background pages

匆匆过客 提交于 2019-12-30 06:28:48
问题 Since there's no clear explanation in Chrome Extensions documentation, I came here for help. I learned that background pages are basically invented to extend the extension's lifetime, and designed to hold values or keep the "engine" running in background so no one notices it. Because once you click on the extension's icon, you get what they call it, a "popup", and once you click outside the "popup" it disappears immediately and most important the extension "dies" (its lifetime ends). So far

Chrome extension run content script on ajax change

怎甘沉沦 提交于 2019-12-30 05:13:17
问题 I have a chrome extension which makes some changes on the site (editing comments). After recent changes on the site (site is not mine) - the comment block loads using ajax (before it was simple post request with the whole page reload). Now if I load the page first time - content script works, but when I go to next page, say page #2 - the comments are added using ajax and the extension script is not run anymore. So the comments are not changed the way I want. Is there any simple way to listen

chrome.windows.getAll() is undefined?

丶灬走出姿态 提交于 2019-12-30 05:13:08
问题 I want to write an extension (a session manager which has more features and eye candy than the ones already in the gallery) for google chrome / chromium. But I can't get the following code to work: function list_session() { var list = []; chrome.windows.getAll( {"populate" : true}, function (window_list) { for(window in window_list) { list.concat(window.tabs); } } ); console.log(list); return list; } It's a fairly simple example for the use of the google api, but instead of a list of tabs I

Chrome extension : Download/export content created “on the fly”

主宰稳场 提交于 2019-12-30 04:42:06
问题 I need to let the user to download a file created on the fly from some data contained in the extension, but I don't want to do this server-side. As a real-world example : There is a variable containing the text "hello world". I want the user to be able to download/create a .TXT file containing such text. Is it possible ? -edited Oct 30, 2010- Solutions so far: window.saveAs - not working at all createObjectURL - works, but the filename and other options can't be customized yet copy data to

Chrome extension commands (keyboard shortcuts) not working

心不动则不痛 提交于 2019-12-30 04:41:08
问题 Any idea how I can get Chrome extension keyboard shortcuts working on a Mac? I have this in my manifest.json "commands": { "trigger_me": { "suggested_key": { "default": "Ctrl+E" }, "description": "Trigger test" } } When I look in the Chrome Extensions tab under Keyboard shortcuts I can see the 'Trigger test' entry but the actual shortcut is not set. How can I set a default shortcut via manifest.json? 回答1: As the manifest key name implies, suggested_key is only a suggestion for key binding.