google-chrome-extension

Javascript - Reading binary data when using chrome.devtools.network.onRequestFinished

人走茶凉 提交于 2019-12-22 18:50:12
问题 So I am building a Chrome DevTools extension that inspects binary traffic on particular website. Requests on site are made with responseType = "blob" . Now when I get request with chrome.devtools.network.onRequestFinished and then access its content with request.getContent() , I get string as response and not blob . This string looks like some kind of binary string but not sure how it is encoded. I tried transforming it to base64 string with a lot of different transforms (Utf-8 to latin, Utf

Intercepting a form submission in a Chrome content extension

痞子三分冷 提交于 2019-12-22 18:42:56
问题 I'd like to intercept the submission of a form on a particular website. The form has no ID, but it does have a name. I'd prefer not to use jQuery, as my extension is very light weight and has no dependencies. The form is not submitted by a button, but by the submit() method. I thought I could just handle the onSubmit event, but it doesn't seem to get raised. Now I'm stumped, any ideas? 回答1: You can catch your form with var myForm = document.getElementsByName('myForm'); Which returns a

Intercepting a form submission in a Chrome content extension

穿精又带淫゛_ 提交于 2019-12-22 18:42:35
问题 I'd like to intercept the submission of a form on a particular website. The form has no ID, but it does have a name. I'd prefer not to use jQuery, as my extension is very light weight and has no dependencies. The form is not submitted by a button, but by the submit() method. I thought I could just handle the onSubmit event, but it doesn't seem to get raised. Now I'm stumped, any ideas? 回答1: You can catch your form with var myForm = document.getElementsByName('myForm'); Which returns a

How to animate chrome extension icon in a callback function?

╄→гoц情女王★ 提交于 2019-12-22 18:38:50
问题 This is a follow up to my previous question about using XMLHttpRequest() to post to my bookmarking app. When I receive the status 200 OK I want to indicate somehow with a change in the extension icon that the request was successful. I created another icon success_icon.png with reverse colors and I am trying to make the new icon replace the original icon and fade into original icon. I understand that this will be inside my callback function but I don't understand how? Here's my background.html

Chrome extensions with jQuery

亡梦爱人 提交于 2019-12-22 18:14:04
问题 I downloaded http://code.google.com/chrome/extensions/samples.html#ea2894c41cb8e80a4433a3e6c5772dadce9be90d. I would like make it it jQuery, but if i do: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script> <script> $("div").css('background-color', 'black'); $('.click').click(function(){ chrome.tabs.executeScript(null, {code:"document.body.style.backgroundColor='" + $(this).attr('id') + "'"}); window.close(); }) </script> <div class="click" id="red">red</div>

How to open chrome extension page programmatically

微笑、不失礼 提交于 2019-12-22 18:13:53
问题 I am a new one for the extension. I want to open a chrome extension page programmatically. Eg: chrome-extension://njlkegdphefeellhaongiopcfgcinikh/options.html When I click the web page button or link I want to open the particular extension tab. I tried many ways. Directly call using javascript and so many ways. But I couldn't find the proper solution. Anybody have any idea. (My target is using JavaScript to open the extension tab) 回答1: Here is one of the solutions: Make sure your content

Unsafe Javascript Access from Iframe in Chrome Extension

寵の児 提交于 2019-12-22 17:49:06
问题 I'm building a Chrome Extension that will be using Iframes that load Flash content. Using Mootools in the Iframe, I'm creating a .swf object and then injecting it into itself. This Iframe, main.html, is inserting the flash object like so: window.addEvent("domready", function () { var flashContainer = $("flash-container"); new Swiff("http://www.example.com/content.swf", { "width":"100%", "height":"90%", "id":"flash-content" }).inject(flashContainer); }); This produces the following error:

Why does my Chrome extension's Action Icon shown on all pages in omnibox?

邮差的信 提交于 2019-12-22 17:39:42
问题 I have following manifest "page_action": { "default_icon": { "19": "images/icon19.png", "38": "images/icon38.png" }, "default_title": "Helper for soiduplaan.tallinn.ee" }, "content_scripts": [ { "matches": [ "http://soiduplaan.tallinn.ee/*" ], But I see icon of my app in all pages I visit: What do I do wrong? =\ 回答1: Your current code is: chrome.tabs.onUpdated.addListener(function(a) { chrome.pageAction.show(a); }); This causes the page action to be shown whenever a page is loaded, ie for

Google Chrome extension to close notification after user click

家住魔仙堡 提交于 2019-12-22 16:29:08
问题 The Chrome extension works fine. My problem is that the notification closes in 7 seconds. I want for the user click to close the notification. function engine(){ var latestId; var ids; var messages = []; var newmessage = []; $.get('http://localhost/site/json.php',function (data){ var json = $.parseJSON(data); messages = json; ids = json[0].id; if(latestId == ids){ //no update }else if(latestId === undefined){ var run = { type: "basic", title: "Title", message: "Some message", iconUrl : "icon

Reading and modifying the HTTP GET request in a Chrome extension

余生颓废 提交于 2019-12-22 14:45:07
问题 I would like to read and modify (add) HTTP headers in a Chrome extension. I am using the chrome.webRequest API for the same. But i am still not able to read it. Here's my code. chrome.webRequest.onBeforeSendHeaders.addListener( function(details) { details.requestHeaders.push({name:"dummyHeader",value:"1"}); return {requestHeaders: details.requestHeaders}; }, {urls: ["<all_urls>"]}, ["requestHeaders"] ); What am i missing? 回答1: You need to add the "blocking" flag to the ExtraInfoSpec list in