spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Chrome Extension, send data between tabs


You can send messages between tabs by using chrome.runtime.sendMessage or chrome.tabs.sendMessage. To receiving the message, add an listener for the message on the receiving tab by using the chrome.runtime.onMessage.addListener method.

Example:

chrome.tabs.create({ url: cr_url },
function(tab){
  chrome.tabs.sendMessage(tab.id, {greeting:
"hello"}), function(){});
});

In the tab:

chrome.runtime.onMessage.addListener(
  function(message, sender, sendResponse) {
    // do what you want to the message
});

Or, you can create the window with window.open, send the message with window.postMessage and recieve the message by catching the Message event with something like window.addEventListener("message", ...);


Categories : Javascript

Related to : Chrome Extension, send data between tabs
Edited Chrome Extension - chrome thinks it is malware
Turns out that I had to make a copy of the extension to an external directory, then delete the existing one. From there, I followed the instructions here: http://superuser.com/questions/247651/how-does-one-install-an-extension-for-chrome-browser-from-the-local-file-system. Text for the lazy: Navigate to chrome://extensions. Expand the developer dropdown menu and click "Load Unpacked E

Categories : CSS
How to close a tab in from a chrome extension?
What's happening after the submit button? Do you send a message to the background? Please note, you can close a tab from the background script. You can call chrome.extension.sendMessage from a content to the background, receive tab object and call chrome.tabs.remove(tab.id);

Categories : Google Chrome
Chrome Extension Multi URL filtering
Your code doesn't work because urlContains expects a single string only. The simplest regex operator that matches "A or B" is A|B. So, in your case { urlMatches : "/shop/jacket|shop/t-shirt" }. It's simple in your case since your URL substrings do not contain special characters; in the general case you may need to -escape some characters.

Categories : Regex
How to remove suspicious Chrome extension in Mac OS
According to https://support.google.com/chrome/answer/3123708?hl=en: Simply hover over the site or domain and click the X that appears and then click Done.

Categories : Osx
Chrome Extension communicate with rest web service
The API you're looking for is called XMLHttpRequest (also known as "AJAX"). Read the documentation at https://developer.chrome.com/extensions/xhr for more information. Here's an example: chrome.browserAction.onClicked.addListener(function(tab) { var link = tab.url; var x = new XMLHttpRequest(); x.open('GET', 'http://example.com/?whatever=' + link); x.onload = function() {

Categories : Javascript
Recently Add
How to get selected text with JavaScript?
Non Modal Alert Messages in java script, activated by a button
How to Count [Combined] line length of multiple files?
Is there any javascript event fired when the on-screen keyboard on mobile safari or chrome opens?
Datatables sort by time ago
Internet Explorer getClientRects absolute positioned elements
How can I transform a CamanJS Filter into a KineticJS Filter?
AngularJS : index not updating after removing array item(s) by index
Slick slideshow in ember.js template
Recursive function with defer
Unable to find module mongodb in simple node.js app
Why does function return false after checking only one value in loop
Detect if the mouse is over an element
Placing and rotating svg elements along a path with Snap.svg
YouTube Asynchronous function
Cordova App: Stop JavaScript from running when App is closed
how to define a variable in an javascript ifstatement
display dd on click using jquery
jQuery Timer Countdown within Session
setInterval on click event to run for 10 seconds
Are syntax errors raised in JavaScript during Tokenizing or Parsing?
Can i perform form based http authentication for my TP-Link Wireless Router(IP: 192.168.0.1)
Blocked frame in reCapcha
Updated property not recognized by $watch
Template Missing error on update only
nodejs object declaration and immediate shorthand if statement crashes the app
Hide / show dynamically generated table columns with right / left animation
Convert UTC Date to Local Date in JavaScript
Position DOM elements without CSS
modifying mergesort to count inversions in JavaScript
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.