Expose object/methods from chrome extention to WebPage - javascript

I'm building a chrome extension with ReactJs. I understood how content-script and background script works but, I'm not able to "share" an object/methods between the chrome extension (popup) and the current web page.
For example:
MetaMask inject a global web3 object, every page can use it and trigger the pop-up chrome extension.
Any idea?

Related

How to get value from chrome extension?

Can I get a value on a local web app from chrome extension? I'm going to use selenium and run the facebook pixel helper extension. Is it possible to decide if the loading website uses facebook pixel on code using facebook pixel chrome extension?
Yes it is. Although, you don't have to use the Facebook Pixel Chrome Extension. Just check the web page source for a script element which contains this string 'https://connect.facebook.net/en_US/fbevents.js'.

Kiosk chrome app: navigate to URL

I have built a Chrome App which needs to load some websites inside its own window.
The purpose is to display full-screen contents on TVs using Google Chromeboxes in Kiosk mode.
I can't use iframes as the content I must load doesn't allow it.
My researches led me to some code like :
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({'url': event.target.href})
})
This seems to open a new tab on the browser running the extension, but not in the extension window.
The vision I have about chrome apps may be confused as it's the first I'm developing, please don't hesitate to tell me the basics I would not have heard of
You need to use the <webview> tag, available in Chrome Apps, to embed external content.
This does not trigger anti-framing protection, since from the point of view of web security each <webview> is a top-level browsing context.
Note the limitations of <webview>: some web features like message boxes or permission requests have to be implemented by you.
As an example of webview usage, see the Browser sample app.

Opening New Windows in Chrome

At my workplace, there is a website we regularly visit to obtain some information. Upon clicking a link in the page, a new window opens and displays the information. This currently works fine in IE8+, but the link is dead in chrome. I've checked and after researching, I believe that chrome is blocking from a new window to open due to security measures. I get no warnings or pop ups, JavaScript is enabled, pop up is allowed for all sites, so now I'm a bit stuck. Is there a built in command to access the chrome features and enable to open new windows? We are using chrome mostly and would like to resolve on this browser. The onclick script looks like this:
onclick="javascript:OpenW('ViewInvoiceEstimate.asp?EIID=2984252&EI=I&Tabname=OPEN')
When I attached the link section of the script as the suffix to the web address, the content shows up fine from the same web browser.

Can a Chrome App launch a window with a Chrome Extension active?

I have written a Chrome extension and a Chrome packaged app. The extension uses the chrome.webRequest.onAuthRequired extension API. I've installed this extension in Chrome.
When I create a window in the Chrome App with chrome.app.window.create, the extension is not active.
How can I launch a window from my Chrome App in which the extension is active?
Ideally, I'd like to be able to use the chrome.webRequest API in my app, but I believe that is not possible.
Also, I understand that communication between a Chrome App and Chrome Extension is possible, (as in this this question), but I really hope I won't have to use message passing, and I don't know if that would even work as I'm not sure I could get the app to recognize when authorization was being requested.
Any thoughts would be appreciated. Thanks!

Possible to open link in Chrome Application from javascript?

From the command line, I can open a url as a chrome application by running e.g.
chromium --app=https://www.stackoverflow.com
Is it possible to do open a url in this mode from javascript in an existing page? To be clear, the url should ideally be opened in a new window, which has the properties implied by the --app flag (e.g. no address bar), whether or not the current page is running in that mode.
My reason for asking is that I'd like to integrate this into vimium.
There is no way to do what you need directly from Javascript. I think you'll need to create an Chrome extension to do that.
You still can find an extension called "Open with external application" which do that, but its use NPAPI and NPAPI is not supported anymore by latest Chrome version. The source is hosted on BitBucket.
The new way to do the same thing is using the native messaging API. In this case the external application would have to register a native messaging host in order to exchange messages with your application. You can see more at http://developer.chrome.com/extensions/messaging.html#native-messaging

Categories