google-chrome-extension

Chrome Web App webview height issue

[亡魂溺海] 提交于 2019-12-19 07:46:06
问题 I'm new in Chrome Web App programming. I want a simple WebApp which is separated to my Chrome/Chromium (means no tab). It shall show a external website in the body. So here is my configuration: manifest.json { "name": "Hello World!", "description": "My first Chrome App.", "version": "0.1", "manifest_version": 2, "permissions": [ "webview" ], "icons": { "128": "icon_128.png" }, "app": { "background": { "scripts": ["background.js"] } } } background.js chrome.app.runtime.onLaunched.addListener

List a local directory with chrome extension

霸气de小男生 提交于 2019-12-19 07:11:21
问题 I'm trying to create a chrome extension which scans a local directory for new files ... However, if I add the file://* permission to the manifest I can access the internal file browser of chrome with xmlhttp.open("GET","file://C:/Users/username/Desktop/",false); xmlhttp.send(); console.log(xmlhttp.response); From the response I could extract the file URLs and use them in my extension. My question is now: Are there other approaches? The above way seems more like a workaround and easily breaks

List a local directory with chrome extension

风格不统一 提交于 2019-12-19 07:11:16
问题 I'm trying to create a chrome extension which scans a local directory for new files ... However, if I add the file://* permission to the manifest I can access the internal file browser of chrome with xmlhttp.open("GET","file://C:/Users/username/Desktop/",false); xmlhttp.send(); console.log(xmlhttp.response); From the response I could extract the file URLs and use them in my extension. My question is now: Are there other approaches? The above way seems more like a workaround and easily breaks

chrome extension: refuse header “date” in ajax request

僤鯓⒐⒋嵵緔 提交于 2019-12-19 06:19:11
问题 I have a javascript code to be used for api (ajax) and I need to send header "date" to api-server (required header), but chrome tells me 'refused to set unsafe header "Date" ' and I get response from api-server like "missing required http date header". I'm using jquery. code sample: var d = new Date(); var headers = {}; headers["Date"] = d.toUTCString(); jQuery.ajax({ url: '<some HTTPS url>' type: "get", crossDomain: true, headers: headers, .... }) the same code works fine in firefox. does

chrome extension: refuse header “date” in ajax request

寵の児 提交于 2019-12-19 06:19:11
问题 I have a javascript code to be used for api (ajax) and I need to send header "date" to api-server (required header), but chrome tells me 'refused to set unsafe header "Date" ' and I get response from api-server like "missing required http date header". I'm using jquery. code sample: var d = new Date(); var headers = {}; headers["Date"] = d.toUTCString(); jQuery.ajax({ url: '<some HTTPS url>' type: "get", crossDomain: true, headers: headers, .... }) the same code works fine in firefox. does

Get the timestamp of loaded page

好久不见. 提交于 2019-12-19 05:56:13
问题 Is there a way in javascript or in chrome extension API to instantly (without saving the timestamp during the loading time) get the timestamp of when the DOM of the page was loaded in Chrome? 回答1: You can use the performance.timing object (implemented by all modern browsers, except Safari) to get all kinds of different timestamps. You need to see for yourself what timestamp would be most appropriate for you. "when the page was loaded" is quite a vague description. Otherwise, be more specific.

How to find the version of Chrome browser from my extension?

非 Y 不嫁゛ 提交于 2019-12-19 05:43:27
问题 I know I can add the minimum_chrome_version property to my manifest file to require at least this version of chrome But what I am looking for is to allow installation of my extension on any chrome version but then from the background page or from my options page check the version of the chrome browser version and based on than either enable or disable some features of my extension that depend on certain minumim version. Surprisingly I was not able to find a way to do this, even googling for

How to find the version of Chrome browser from my extension?

房东的猫 提交于 2019-12-19 05:43:07
问题 I know I can add the minimum_chrome_version property to my manifest file to require at least this version of chrome But what I am looking for is to allow installation of my extension on any chrome version but then from the background page or from my options page check the version of the chrome browser version and based on than either enable or disable some features of my extension that depend on certain minumim version. Surprisingly I was not able to find a way to do this, even googling for

Finding bottlenecks in javascript?

情到浓时终转凉″ 提交于 2019-12-19 05:36:11
问题 I'm attempting to find a bottleneck in my Javascript. Basically I'm developing a chrome extension written in Javascript which is taking 4-5 seconds to perform a task. There's a lot of code involved in the task and using print statements / chrome built in dev tools just isnt working. The dev tools don't seem to even see my Javascript running. I'm wondering if anyone has any advice / tools they think could be of benefit? 回答1: Open your page in Chrome. Tools -> Developer tools -> Profiles Start

Chrome: Getting iFrame and inserting into body

雨燕双飞 提交于 2019-12-19 04:09:35
问题 I've got the following code which works fine in Firefox... if (!iFrame) iFrame = outerDoc.getElementById('_dialog_iframe'); var iFrameDoc = iFrame.contentWindow.document; // get iframe doc and the Chrome version... if (!iFrame) iFrame = outerDoc.getElementById('_dialog_iframe'); var iFrameDoc = iFrame.document; // get iframe doc I'm testing the code be getting iFrameDoc.body when I run the FireFox code in Firefox it works fine. However, the Chrome code returns undefined . Why? How do I fix