google-chrome-extension

Localizing a Google Chrome Web App

自作多情 提交于 2020-01-05 05:21:25
问题 I'm trying to add localization support to a Google Chrome Web App and, while it is easy to define strings for manifest and CSS files, it is somewhat more difficult for HTML pages. In the manifest and in CSS files I can simply define localization strings like so: __MSG_name__ but this doesn't work with HTML pages. I can make a JavaScript function to fire onload that does the job like so: document.title = chrome.i18n.getMessage("name"); document.querySelector("span.name").innerHTML = chrome

Localizing a Google Chrome Web App

梦想的初衷 提交于 2020-01-05 05:21:03
问题 I'm trying to add localization support to a Google Chrome Web App and, while it is easy to define strings for manifest and CSS files, it is somewhat more difficult for HTML pages. In the manifest and in CSS files I can simply define localization strings like so: __MSG_name__ but this doesn't work with HTML pages. I can make a JavaScript function to fire onload that does the job like so: document.title = chrome.i18n.getMessage("name"); document.querySelector("span.name").innerHTML = chrome

Chrome extension - just to save current page into local html file

时光总嘲笑我的痴心妄想 提交于 2020-01-05 04:37:11
问题 I am new to both Chrome extension development and website techniques (mainly JS). Trying to learn by myself, I wanted to create a Chrome extension that can save the current page, say, to desktop. I know this simply can be done by "Ctrl+S", but I want to implement the same thing as a Chrome extension. If possible, I want to create an extension that first create a popup menu, in which the top row will be the button to save page. I tried to figure it out by myself, however, I got the code below,

Can't remove inline event handler in chrome

天涯浪子 提交于 2020-01-05 03:07:40
问题 I want to delete an event handler form a form that contains an inline definition of onsubmit. <form id="loginForm" onsubmit="return performTask(this);"> I have already try : $("#loginForm").off("submit") $("#loginForm").unbind("submit") $("#loginForm").die("submit") $("#loginForm").removeAttr("onsubmit") $("#loginForm").removeProp("onsubmit") $("#loginForm").attr("onsubmit", "") $("#loginForm").prop("onsubmit, "") $("#loginForm")[0].onsubmit = null $("#loginForm")[0].onsubmit = undefined $("

button in popup.html not working

為{幸葍}努か 提交于 2020-01-05 03:00:29
问题 I have a popup.html, and what I thought was pretty simple listener event. This is my popup.html: <!DOCTYPE html> <html> <body> <button id="button">Starting Now</button> <script> function blah(){ alert("blah"); } $(document).ready(function(){ document.getElementById('button').addEventListener("click", blah); }); </script> </body> </html> There's no alert when I press the button; what am I doing wrong? 回答1: Your code is okay from normal web-page point of view but from the guidelines of Chrome

chrome extension: get specific part of the current tab page in DOM object and display it in either popup.html or new html page?

北城余情 提交于 2020-01-04 10:58:09
问题 IS there any way so that i can convert any DOM object into HTML page within the script ? suppose I have dom object like this: content script.js chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "fromPopup") { console.log("got Request from Popup"); var myDivObj = document.getElementById("definition"); //sendResponse({data: "from Content Script to Popup"}); if ( myDivObj ) { sendResponse({data:myDivObj}); } else{ sendResponse({data:"Empty or

Accessing a pages object using a Chrome Extension

痴心易碎 提交于 2020-01-04 10:39:07
问题 I simply have to access an object that is a variable on the page that I am running my content script on from my Chrome Extension. I know about the environments and their isolated worlds in which the content scripts and injected scripts run and that it's possible to get some variables using the injected scripts and then send them back. I have searched for other answers regarding this question and most work for other type of variables and are the basic way of doing it but none currently work

How can I override javascript files referenced with the crossorigin=“anonymous” using a Google Chrome extension?

偶尔善良 提交于 2020-01-04 08:18:05
问题 In the response HTML of a website, with a domain like http://www.example.com , there are many javascript files referenced. One of them references a javascript file on a different domain, and this script tag has the crossorigin="anonymous" attribute set: <script crossorigin="anonymous" src="//cdn.example.net/script.js"></script> I've attempted to redirect the request to another url using a Google Chrome extension: chrome.webRequest.onBeforeRequest.addListener(function(info) { return {

How can I override javascript files referenced with the crossorigin=“anonymous” using a Google Chrome extension?

走远了吗. 提交于 2020-01-04 08:17:13
问题 In the response HTML of a website, with a domain like http://www.example.com , there are many javascript files referenced. One of them references a javascript file on a different domain, and this script tag has the crossorigin="anonymous" attribute set: <script crossorigin="anonymous" src="//cdn.example.net/script.js"></script> I've attempted to redirect the request to another url using a Google Chrome extension: chrome.webRequest.onBeforeRequest.addListener(function(info) { return {

Google Chrome Plugin development - Monitor network requests?

孤人 提交于 2020-01-04 07:52:35
问题 Is it possible to monitor network traffic with a google chrome plugin for the local page? For example, I want to monitor every time a web page requests a specific file (based on regex match), and if a user clicks the plugin, it opens a new tab to that file. 回答1: The "proper" way would be to use webRequest API, but it is still experimental: //background.html chrome.experimental.webRequest.onCompleted.addListener(function(details) { console.log("resource", details.url); }); Meanwhile you can