google-chrome,google-chrome-extension,content-script , Can Chrome extension content script access all tabs?


Can Chrome extension content script access all tabs?

Question:

Tag: google-chrome,google-chrome-extension,content-script

Basically, I want to get all the opened tabs of the browser window, from within a tab, more specifically, in content script.

I tried chrome.tabs.query, it works in background script, but doesn't work in content script.

So my questions are:

  1. Is there a way to do such work? Maybe an API that I wasn't aware of?

  2. Or, can I dispatch an event from content script, then capture the event in background script, and vice versa?

  3. Or, is it just impossible?


Answer:

According to https://developer.chrome.com/extensions/content_scripts , a content script cannot access chrome.* APIs, except a few allowed ones but chrome.tabs is not among them

Exchanging messages with the parent script is possible, though, so this might be the way to do it. See https://developer.chrome.com/extensions/messaging


Related:


How to set caret to newly added element in contentEditable element?


javascript,jquery,google-chrome
I am working on a WYSIWYG editor in which I want to add <p>'s when hit Enter / Return key and then the user will write to this new <p>. Right now I am having issue setting the caret to this new <p>. $('#content').on('keypress', function(e){ if(e.which === 13){ console.log('enter pressed');...

What's the best way To edit CSS and JS of Html Template [closed]


javascript,css,html5,google-chrome,google-chrome-devtools
I have a HTML5 Template in my Local Computer. I want to edit this template CSS and JS to use in my project. I use this solution to edit Template Open Web site With Google Chrome also Open with Notepad++ Edit CSS file with Notepad++ and Refresh page in Google...

How to use a Web Inspector with emulated android device (AVD)


android,google-chrome,android-emulator,avd,web-inspector
I have the Android SDK downloaded (on a mac), and no access to Android hardware. I can start up AVD and emulate various android devices fine, but I have some CSS I'd like to inspect in the Android browser on said emulated devices. I just can't figure out how to...

How to display red borders on required or invalid value input element in Chrome just like Firefox behaviour for HTML5 validation?


css,html5,google-chrome,firefox
I have to bring red borders around the input element in chrome on HTML5 validation like as that of Firefox. I have search it a lot but unable to find precise answer. Any help of how to do it using css is greatly appreciated. Thank you....

Intern's pollUntil does not work with Chrome


javascript,google-chrome,intern,leadfoot
I have a custom crawler that redirects to all pages in an application and takes screenshot. The page load works perfectly fine in Firefox. However in Chrome, the page does not load properly and as a result most of the screenshots come as blank. return remote.get(newAddress) .then(pollUntil('return document.readyState==="complete";', [], 30000))...

Chrome Extension - How to execute a JS script on page load


javascript,google-chrome,google-chrome-extension,google-chrome-devtools
The following is that I'm trying to achieve Every time 'www.google.com' loads, a script/function triggers. However, the functions itself reloads the page via 'location.reload();' Basically, an infinite loop of reloads. Script reloads page -> Script injected -> Script reloads page -> etc. I want the tab @ google.com to keep...

What is the name of the language in which the main program of Chromium is written?


google-chrome-extension
We would like to develop a new plugin for Chromium. To achieve this goal, we must learn at least one computer language. We do not know its / their name(s). Do you know the name of the computer language in which is written the program contains 1) the variable whose...

Run a function from injected js


google-chrome-extension
I have been going around in circles with this, so I would appreciate some help This is what I want to achieve User presses my extension ison Popup appears with two buttons, 'run function a' and 'run function b' When they press a button it runs the function in my...

Chrome UDP sockets not receiving from remote machine


javascript,sockets,google-chrome,udp,google-chrome-app
I'm working on a Google Chrome app that contains the following code: var socket = chrome.sockets.udp; var PORT = 5005; var HOST = '127.0.0.1'; socket.create({}, function(sockInfo){ socket.bind(sockInfo.socketId, HOST, PORT, function(result){ socket.onReceive.addListener(function(info){ // do stuff with the packet data }); }); }); This mechanism worked perfectly when I was sending data...

Looking for tool that prevent script to become unresponsive [on hold]


javascript,browser,google-chrome-extension
For a side project I need to generate a lot of data from a WebGL Application. This Web App is mostly a personal tool and I really don't care if my browser become unresponsive (I mean, I know it will). Does someone know a browser/tool/plugin that could allow me to...

1px white spacing in Chrome between div's


css,google-chrome
JSFiddle: http://jsfiddle.net/lustre/c6cwbjLz/13/ Basically, I've been trying to make a full-screen 3x2 grid, and have essentially achieved it, however I'm seeing a tiny 1px vertical line between the 2nd and 3rd columns when I hover over the grid items. Where is this coming from, and how do I get rid of...

Mismatched anonymous define() in Chrome extension content script


google-chrome-extension,requirejs,typescript
I'm trying to build a Chrome extension with TypeScript. The setup is quite simple: In manifest.json { "permissions": [ "webRequest", "webRequestBlocking", "tabs", "storage", "http://*/", "https://*/*" ], "content_scripts": [ { "matches": [ "http://*/*", "https://*/*" ], "js": [ "scripts/require.js", "scripts/require-cs.js", "scripts/main.js", "scripts/contentscript.js" ], "run_at": "document_end", "all_frames": true }], } In model.ts: export...

Chrome - Script tag isn't blocking


javascript,html,google-chrome
In the following example: <script src="1.js"></script> <script src="2.js"></script> <img src="FDA.PNG" alt="" /> The first tag should block the parsing of the html, but according to the timeline, it's not. All the files are loading at the same time, why?...

$(this).val() not working in FireFox but works in Chrome


javascript,jquery,html,google-chrome,firefox
This is my problem. When I try to set the value of an input field in FireFox nothing happens. I don't get any errors. It simply just doesn't work. It is supposed to add two decimal places after the number. It works perfectly in Chrome. Here's my jQuery code... $('input.drawer').on('blur',...

How do I change chromes Date-parsing / Sorting to match ff/ie Dateparsing?


javascript,jquery,google-chrome,date,momentjs
So I encounter a very weird problem here and am out of ideas at the moment. I've the following function to parse and sort a json object by its property RowDate, containing datestrings with the following format: "/Date(1389682861507+0100)/". orderByDate: function (json) { debug('[DataCollection::orderByDate], json before ordering: ', json); _.each(json.LineDefinitions, function...

What does the double colon mean in Scope Local variables in Chrome's debugger?


javascript,google-chrome,debugging
See the screen dump fragment below. Notice that there are two colons between legend and Object (legend is a field of ptd). What does the double colon mean? My problem is that if I test the value of ptd.legend, it is 'undefined'. Which it shouldn't be... ...

Is there a way to set breakpoints for every js line in the chrome dev tools?


javascript,google-chrome,devtools
I am quite new to javascript, I often find the need to walk through JS codes line by line to get better understanding how the code works. But manully setting breakpoints for each line in the 'source' panel of chrome is just too time-consuming, is there a way to do...

css tricks for font awesome in placeholder for chrome


html,css,google-chrome,placeholder
can any one tell me why my font awesome is not working properly in chrome though its working fine with firefox?but if i remove the awesome font then it becomes ok again.click here to see the image here is the html code for my form : <!DOCTYPE html> <html> <head>...

HTML & CSS - Full Screen Image


html,css,html5,google-chrome,website
I'm working on a website where I want an image to straight away take up the screen. I want to make it take up the available screen but when you begin to scroll down I want a div to appear with the text and information. I do not mind if...

Text Align Center in Chrome (webkit)


css,google-chrome
Any idea why text-align: center doesn't center the text within the table cells? But text-align: -webkit-center does? The reason why display: table-cell is applied is to have vertical-align to work. Removing it is not a solution and doesn't answer my question. .wrapper { text-align: center; } .column { width: 33%;...

How to force loading images for the webpages installed “lazy load” without scrolling?


javascript,google-chrome-extension,lazy-loading
I implement a Chrome extension. The extension needs to get all images URLs of webpages. However, some webpages have "lazy load" plug-in. My question is if it is possible that I can still get URLs without required manually scrolling down?

Three.js + Chrome 43: Error creating WebGL context


javascript,google-chrome
I get an "Error creating WebGL context" error when running this script in chrome 43 under Ubuntu Linux. It worked perfectly fine in chrome 42 ad in the stable release of Firefox. Here's the stack trace: Error creating WebGL context.THREE.WebGLRenderer @ three.min.js:517(anonymous function) @ pen.js:24(anonymous function) @ pen.js:120 Note that...

for of loop querySelectorAll


javascript,google-chrome,for-loop,mozilla,queryselectorall
Mozilla states that "for of loops will loop over NodeList objects correctly". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn't work in Chrome 43. Is this incorrect documentation or a browser bug? The copied example code used on a page with checkboxes: var list = document.querySelectorAll( 'input[type=checkbox]' ); for (var item of list)...

chrome linkurl not returning proper url


javascript,jquery,google-chrome
I was doing some chrome extension dev and I found linkurl method giving some strange url back like this "https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0CDQQFjAD&url=https%3A%2F%2Fdeveloper.chrome.com%2Fdevtools%2Fdocs%2Ftips-and-tricks&ei=41OEVfSXG4nioATdvrCAAQ&usg=AFQjCNHiSugE_b8f5LZbiamLQzS2Df2I9Q&sig2=acYqGi4bSiUgLeO4HwwM5Q&bvm=bv.96339352,d.cGU" Is there any way we can get the proper url ? My code is here function genericOnClick(info, tab) {...

CSS flexbox wraps content in FireFox (not Chrome)


css,google-chrome,firefox,flexbox,pseudo-element
I have a button that consists of an <i> and an <span> element (an icon and some text). Now both have different sizes so I'm applying a flexbox to my button that should center my items nicely. In Chrome everything works as I expected but using the page in a...

$.ajax.done works on Firefox but not in Chrome


php,jquery,ajax,google-chrome
I have a very simple AJAX request with jQuery and PHP. This is my code var request = $.ajax({ method: "POST", url: "Url.php", data: { param: valueParam }, dataType: "html" }); request.done(function(html) { alert('Hello'); }); The code works perfect in Firefox 38.0.5 but not works in Chrome 43.0.2357.124m. The problem...

php redirection working in chorme but not on firefox


php,google-chrome,mozilla
Below is my php code that caries out the redirection Code Snippet :- echo "<form action='exp_yogesh.php?id=$id' method='post'>"; echo "<td> <input type='image' name='putonline' value='$id' src='images/on_button.png' no-repeat; border:none;' alt='submit'> </td> "; echo "<td> <input type='image' name='putoffline' value='$id' src='images/off_botton.png' no-repeat; border:none;' alt='submit'> </td> "; echo "</form>"; Here's the exp_yogesh.php file <?php include 'includes/connection.php';...

String replace with regex, ie strange results


javascript,regex,google-chrome,internet-explorer
Why i have this results? "hello world".replace(/[']/gi, "\\'"); // on chrome => "hello world" "hello world".replace(/[']/gi, "\\'"); // on ie => "hello world" "hello world".replace((/[']/gi).compile(), "\\'"); // on chrome => "hello world" "hello world".replace((/[']/gi).compile(), "\\'"); // on ie => "\'hello world" Chrome: 43.0.2357.124 m IE: 11.0.10011.0...

Rss is not working in Google Chrome usin PHP MYSQL


php,mysql,google-chrome,rss
I have a problem in my code I cant understand that problem. Problem is that my code is only run on Mozila Firefox. when i try to execute it on Google Chrome its begin to download my file and not executed. below is my code <?php include_once'connect.php'; header ('Content-Type: application/xml:...

“Tainted canvases may not be loaded” Cross domain issue with WebGL textures


google-chrome,gwt,libgdx,html5-canvas,webgl
I've learnt a lot in the last 48 hours about cross domain policies, but apparently not enough. Following on from this question. My HTML5 game supports Facebook login. I'm trying to download profile pictures of people's friends. In the HTML5 version of my game I get the following error in...

Google reCAPTCHA fail for second time submit


javascript,php,jquery,google-chrome,captcha
I implement the reCAPTCHA in this tutorial, https://codeforgeek.com/2014/12/google-recaptcha-tutorial/ which work well for the first time submit. The problems I have are: I send the captcha with other form data e.g. username , email etc.... so if captcha is correct but other not , the user will send it again, but...

Document won't load into iframe with changed, but proper, name


javascript,html,google-chrome,iframe
What I'm trying to achieve is being able to load contents of href in to one of three iframes, by changing thier names via java. The problem is: Chrome will always load contents into first iframe, ignoring it's name change, this problem does not occur in Firefox. function change_name() {...

Host my own chrome extension in my website


google-chrome-extension
I have developed one chrome extension and i want to use it on some windows pc's all over the world (of course the owners know me and my work) but i dont want to upload it on WEBSTORE since its only for something we use for ourselfs. Could i host...

Google Chrome - How to compile Google Chrome in Windows?


google-chrome,visual-c++,windows-8.1,ninja
Documentation mentioned to compile i have to follow this instruction for Windows: http://www.chromium.org/developers/how-tos/build-instructions-windows So i did all the steps, but the following is failing how can i resolve it? C:\tpt\depot_tools>mkdir out\Debug C:\tpt\depot_tools>ninja -C out\Debug chrome ninja: error: loading 'build.ninja': Het systeem kan het opgegeven bestand niet vinden. ninja: Entering directory...

Why does chrome.tabs.create create 2 tabs?


google-chrome-extension
When the chrome.tabs.create function is triggered by a message received, it creates 2 tabs. In the following demo code, 1 cat tab is created, and 2 dog tabs are created. Is this by design or is it a bug? If it is a known bug, can you provide the bug...

Character rendering is different (IE/Chrome)


html,css,google-chrome,internet-explorer
I'm trying to figure out why does the arrow symbol render differently on Chrome and Internet Explorer but without any success. Surprisingly IE displays it correctly while Chrome has problems with rendering. Ignore the difference in size, it is due to zooming. Chrome IE Regarding CSS, there is only Eric...

Bug in Chrome: render big box-shadow


css,google-chrome
I just want to set box-shadow of div to: ... 0 0 500px ... (big blur value). In Google Chrome (last version, windows & ubuntu) I see strange squares-artefacts. In Firefox I get just a normal shadow. JSFiddle: http://jsfiddle.net/2GRGF/1/ (from How to create a box-shadow that covers the entire page?)...

Access DOM elements data document->Iframe ->Iframe->method chrome extension


javascript,google-chrome,iframe,google-chrome-extension
I'm trying to access some data from an iframe nested within an iframe, from developers console: Object.keys(document.getElementById("contentBody"). contentDocument.getElementById('rawContent'). contentDocument.defaultView.window.messages) ["29c736c0ed25463c8436f4990ab6c6ec.zip", "235819a8cf11488e83f0336603b71711.zip", "66c9260590834d9698568c8a676ef406.zip", "fae95e31cb424cd6ad21302217ef2cdc.zip", "f554f712141047aa9aa24f765073e305.zip", "e5c41819578240e0868f43ab6301aeb3.zip"] That's what I expect back, but I've tried to get that...

“sort not a function” error in angularjs only in google chrome


javascript,angularjs,google-chrome,sorting
I ran into this problem and am unable to figure out why and couldn't find any explanation on google. I have a $http.get method to retrieve some data from a url, on success i am sorting the response. But when I run the page on google chrome, I get the...

Chrome Push Notifications: can't subscribe from sub-path


google-chrome,push-notification
I'm trying to subscribe to the pushManager, and I can only achieve it while on the root (/) path. If I navigate to any sub path (/mypath), I recieve Unable to subscribe to push. DOMException: Registration failed - no sender id provided. The problem is that in order to subscribe,...

woocommerce thumbnails have different image widths in chrome and mozilla


html,css,wordpress,google-chrome,mozilla
Hello I recently run into a weird issue. I am running a Woocommerce theme built on bootstrap 3. I did some custom CSS modification and Image thumbnails appear REALLY narrow on Chrome and fine on Thunderbird. Could someone help me? I might be missing something fundamental here... Before you ask,...

C# native host with Chrome Native Messaging


c#,google-chrome,chrome-native-messaging
I spent a few hours today researching how to get Chrome native messaging working with a C# native host. Conceptually it was quite simple, but there were a few snags that I resolved with help (in part) from these other questions: Native Messaging Chrome Native messaging from chrome extension to...

How to make function in loop run synchronously?


javascript,jquery,loops,google-chrome-extension,synchronization
Am working on a chrome plugin, and need to sendMessage from an 'app page' to a 'content script' and then get the return messages, from inside a loop. But since the loop doesn't wait for the sendMessage to return a value before starting on the next iteration, it is screwing...

Can I fire up a Chrome extension API from code?


javascript,google-chrome,google-chrome-extension
Is it possible to launch a Google Chrome extension within a website? E.g run some javascript that will launch the extensions UI? I'm building a web-app that will allow users to take screenshots of their desktop and edit them. I've got a sample extension up and running using dektopCapture but...

Difference between Google Chrome and Canary


google-chrome
i would like to know that what is the main difference between chrome and canary as the official site says, Google Chrome Canary has the newest of the new Chrome features. Be forewarned: it's designed for developers and early adopters, and can sometimes break down completely. So what is the...

Simple Chrome Extension : Open an url in a new tab


google-chrome-extension
I'm looking to create a "new tab" extension like Panda or the Product Hunt Extension: the user can open a new tab with my website inside, with an hidden url. I've generated my package with the awesome Extensionizr and here is my manifest.json : manifest.json { "name": "My app", "version":...

How SCSS rule evaluation done by browser


html,css,google-chrome,mozilla
I am working on a project where i am using an internal UI Library. In one of the CSS file, i saw something which looks strange. To simplify things, I am reciprocating with basic html elements and corresponding css: CSS: div{ border:1px solid black; width:100px; height:100px; } .parent //some comment...