How to get value from chrome extension? - javascript

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'.

Related

Expose object/methods from chrome extention to WebPage

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?

Click a button in Google Chrome not using Selenium

I'm trying to install a google chrome extension on a large amount of my desktop computers using python. I've gotten Selenium to open a simulated browser with the extension, but that doesn't actually download it to the computer, so that doesn't necessarily help. My current code is
import webbrowser
webbrowser.open_new_tab(
"https://panelresearch.google.com/browser/extension/download")
This just opens the page where I can find the extension, can anyone show me a library where I can click buttons that are on this page?
Additionally, I'll need to identify the extension popup and I realized that I cannot inspect any elements in that popup.
As far as I know, there is no way of operating the extension popup using any API other than simulating the clicking on OS level.
When you're testing an extension using Selenium, you have to specify a custom profile as an argument during the start of the process connected to the WebDriver. More info here or use a special ChromeDriver API.
If you just want to force install an extension in an enterprise/educational environment, you can follow this guide.
You can also edit already existing profiles (to some extend and in my experience unreliably) by editing the Preferences file in the profile directory. Just make sure you have backups and an instance of Chrome is not running with that profile.
Good luck.

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

Does chrome have some sort of api that lets you control downloads

I am building a chrome extension and would like to be able to have some link between the chrome download manager (ctrl j) and the extension.
Just a simple example the describes what i am trying to accomplish:
An extension that opens a window asking you (are you sure you want to download this file) every time the user downloads a file on chrome.
Thank you.
It would appear that this is possible, with explicit permissions.
From the chrome dev guide.
https://developer.chrome.com/extensions/downloads

Chrome Tab Sync javascript API

Is there a javascript API for Chrome Tab Sync for web sites? I'm not asking about Chrome Extensions, just web sites.
For example, I'd like to store some text (a string) when you open a web site on the desktop then when you open that same page in the chrome mobile browser I'd like to display that stored text.
Is this possible? I know with Chrome Extensions there is chrome.storage, but I don't believe that is available for websites.
You should store that information:
on your server,
in the URL of the page (?mystring=...),
or on your server with a lookup key for the specific info in the URL.
Any one of these is an ordinary thing to do and will work for all browsers and all ways to get a page from one device to another, without relying on any features specific to Chrome.

Categories