google-chrome-extension

JSONP request in chrome extension, callback function doesn't exist?

吃可爱长大的小学妹 提交于 2020-01-19 01:10:04
问题 I am making a JSONP request in a chrome extension (content script) . Everything works very well when I am running as a webpage -loading the HTML file in my browser-, but when I load it as a chrome extension, the jsonp callback function created by jquery doesn't seem to exist when the server gives its response. My console says: Uncaught ReferenceError: jQuery17105683612572029233_1323808231542 is not defined Here is my ajax request: $.ajax({ url: 'http://example.com', data: { imgUrl: this.href,

JSONP request in chrome extension, callback function doesn't exist?

北战南征 提交于 2020-01-19 01:09:42
问题 I am making a JSONP request in a chrome extension (content script) . Everything works very well when I am running as a webpage -loading the HTML file in my browser-, but when I load it as a chrome extension, the jsonp callback function created by jquery doesn't seem to exist when the server gives its response. My console says: Uncaught ReferenceError: jQuery17105683612572029233_1323808231542 is not defined Here is my ajax request: $.ajax({ url: 'http://example.com', data: { imgUrl: this.href,

Creating play/pause functions with current audio javascript

半世苍凉 提交于 2020-01-17 08:15:18
问题 I have an extension for chrome I am working on, I have an HTML popup that has buttons that play audio. I don't think my approach is the most elegant and I am having trouble exploring ways to shrink this down. I know this is very inefficient. I want to be able to tell which button was clicked on the HTML page, then using that ID play the audio file with that same ID. The way I have it now is using the EventListener in javascript to use multiple functions to stop or play. Is there a way to put

How to dispatch KeyboardEvent in Chrome extensions

无人久伴 提交于 2020-01-17 06:40:33
问题 Does Chrome allow firing KeyboardEvent by using content script in Extensions? I was trying to change every character entered to the page to the same character, but when I load the extension, the "dispatchEvent()" function gave me "Uncaught RangeError: maximum call stack size exceeded", can someone check my code? Thanks! So in the content script I first standard keyboard input, then create a new keyboardevent and dispatch it. The error is on "dispatchEvent()" function. Manifest.JSON {

How to dispatch KeyboardEvent in Chrome extensions

删除回忆录丶 提交于 2020-01-17 06:39:27
问题 Does Chrome allow firing KeyboardEvent by using content script in Extensions? I was trying to change every character entered to the page to the same character, but when I load the extension, the "dispatchEvent()" function gave me "Uncaught RangeError: maximum call stack size exceeded", can someone check my code? Thanks! So in the content script I first standard keyboard input, then create a new keyboardevent and dispatch it. The error is on "dispatchEvent()" function. Manifest.JSON {

Chrome App onSubmit

家住魔仙堡 提交于 2020-01-17 05:20:06
问题 I have a very simple Chrome App. It displays a popup with a search box. Submitting the search box opens my site in a new tab. The search box is empty by default. When it is empty, clicking submit shouldn't do anything. My popup.html looks like this: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>foo</title> <link rel="stylesheet" type="text/css" href="popup.css" /> </head> <body> <div id="srch"> <form target="_blank" action="foo.php" method="get"

chrome extension: the js script fires too early despite run_at: document_idle

折月煮酒 提交于 2020-01-17 04:44:33
问题 In theory, if I set run_at, the .js that I use to select an element on the page should fire after the page is completely loaded. But it doesn't appear to be the case. In my content.js, I have "content_scripts": [ { "js": ["extensions/jquery-2.2.2.min.js", "content.js"], "run_at": "document_idle" } ] In my content.js, I simply have: alert("alert"); console.log("hello"); var fullname2 = $('#topcard').find('.profile-info').find('h1').text(); console.log(fullname2); Both the alert and the first

Content Script is not working in chrome extension

耗尽温柔 提交于 2020-01-17 03:03:28
问题 I use XMLHttpRequest in content script. The code works whenever a new tab opens, but it stops working whenever a tab is updated. tabupdation API only works in background. Manifest : { "manifest_version": 2, "name": "extension", "version": "1.0", "description": "", "icons" : { "48" : "48X48.png", "128": "icon1.png" }, "background": { "scripts": ["background.js"], "persistent": true }, "content_scripts": [{ "matches": ["<all_urls>"], "js": ["content.js"], "all_frames": true }] } The content

How to redirect some pages in Google chrome extension?

喜你入骨 提交于 2020-01-17 02:50:10
问题 I am using chrome.webRequest.onBeforeRequest in my background script to listen to all request a user is making. My extension now is just a manifest and this bg script. I then check if the url matches a regex: chrome.webRequest.onBeforeRequest.addListener( checkRedirect, {urls: ["<all_urls>"]}, ["blocking"] ); function checkRedirect(details) { var location = getLocation(details.url); if(/some_regex/.test(details.url)) { var redirect_url = 'http://some_redirect.com' + location.pathname; chrome

Chrome Extension iframe dom reference disqus

时间秒杀一切 提交于 2020-01-17 01:21:47
问题 How do I get a reference to the dom of a cross domain iframe/frame? I want to do some stuff to disqus comments with an extension. My manifest has the following: "all_frames": true, "matches": ["*://*.disqus.com/*","*://disqus.com/*", "http://somesite.com"] I am not trying to communicate outside of the frame - that is the js will take care of the work without needing to 'tell' me anything. all_frames should inject the listed js files into every frame, no? When I do this: if (window != window