How to install browser extension from my program - browser

I want to bundle an extension with my executable, and I want it to automatically add it to the users browser if they have chrome or firefox. Is there a directory where I can drop the .crx file containing the extension for chrome, and chrome will automatically use it? And what should I do for firefox?

If you want to simplify things you can use Crossrider and get an installer which will install your extension on IE, Firefox and Chrome.
This installer can also run in silent mode, so you run it from your executable without interrupting the normal flow.
To do all that, you will first have to open a new user and copy your extension code to Crossrider (which is probably a good idea anyway since then you will have one code for your app which will support all browsers).

For Chrome:
You can put it in the registry or drop it in the external-extensions.json file (%localappdata%/Google/Chrome/Application/chrome_xx.xxx.xxx.xxx/Extensions/).
I never did it myself actually but it's all documented on the official channel:
http://code.google.com/chrome/extensions/external_extensions.html
There's also a way to install it via Group-Policy, but none of all these three methods is cross-platform AFAIK.
For Firefox:
I have no idea.

My recommendation would be:
DO go through the browser itself,
DO NOT try to sneak around and force it onto the user
Reasons for this are:
the browser is meant to ask for the user's permission, clearly and explicitly.
that's the only cross-platform way I know (and it already requires forking out, so that's not even that totally cross-platform).
I'd simply recommend forking out a browser and passing as argument the extension's file or download URL, so that it will automatically request the user's permission and start the installation process.
For instance, just calling this (on linux, if google-chrome is on your PATH):
google-chrome PATH_TO_FOLDER_OR_URL_PREFIX/myextension.xpi
Or:
google-chrome PATH_TO_FOLDER_OR_URL_PREFIX/myextension.crx
Or for Firefox:
firefox PATH_TO_FOLDER_OR_URL_PREFIX/myextension.xpi

Related

Visual Studio Code DDEV and auto reload on Linux

I'm using DDEV with Visual Studio Code and I tried to configure Live Server Extension to automatically auto reload page that I'm working on in Chrome when I hit save in VSC, but it doesn't seem to work with PHP.
Is there a way to configure this to work with DDEV?
I can't seam to find any info on this issue.
Thanks
I've managed to do it another way, with guard and guard-liveguard on linux.
The workflow was:
guard installation
guard-livereload installation
Installation was not quite straightforward, but you can follow the instructions in Terminal and install what's missing if it tells you so.
Guard placed Guardfile inside of /home/user directory so I edited it to contain only this, regarding livereload pard:
guard 'livereload' do
watch(%r{.+\.(css|scss|html|php|js)$})
end
Then I installed Liveguard Google Chrome Browser Extension from here:
http://livereload.com/extensions/
Under settings I had to enable "Allow access to file URLs".
Also, you have to press liveguard extension icon in Chrome in order for it to track changes.
That's about it, now when I edit any of the file types entered in Guardfile (you can edit and add what you need, of course) it automatically reloads my Chrome window whit the edited page opened.

How To ADD Firefox Default Applications

So I'm trying to find a way to add default file extensions options to Firefox. Since for whatever reason it doesn't give you the option?
Example: Settings > General > Applications
I want to add new content types and then be able to select my default application of choice.
The current issue is, that I use an MSP client that when necessary allows us to remote into a client's workstation for troubleshooting. Normally one would just click on the "Start Remote Session," button, and it brings up the application to do so. However, since it operates in some form of Javascript (I think....?), it doesn't technically download a file for me to save and then execute through the app. It just opens the app automatically. It never gives me the option to save the a file or anything like that, that it would use for the Remote Session app.
So I want to figure out how to bypass this issue by just adding the extension needed for this process in Firefox's default content types.
Works on Windows, I'm currently on Linux. (So please don't tell me to not use linux or any form there of. That or to use wine or playonlinux. I already am)

Stop node-debug from opening a new browser window

The command:
node-debug sls offline
opens a new browser window every time it is run.
How do we stop it from opening a new window every time? I want to reuse the existing window!
This is a known issue with node inspector. Take a look here.
Since 0.9.0 we use https://github.com/benderjs/browser-launcher2 to
start the browser, and make sure it's Chrome/Chromium/Opera (i.e. the
browsers that can properly render node inspector; we detect installed
browsers in the system and choose the most appropriate one; earlier we
used opener module which just delegated opening the browser to the OS,
which would open the defaul browser, which could have been e.g.
Firefox) and this could be the reason why the behavior has changed.
browser-launcher2 actually does a bit more than just launching a
browser, for instance it creates a new profile for Chrome in a
subfolder of ~/ - this is probably the issue that #CalvinScott
reported (i.e. Chrome that was opened was the new profile created by
browser-launcher, not your original profile; you should be able to
open your original profile of Chrome normally)
Also, you may consider this:
Since version 6.3, Node.js provides a buit-in DevTools-based debugger
which mostly deprecates Node Inspector, see e.g. this blog post to get
started. The built-in debugger is developed directly by the
V8/Chromium team and provides certain advanced features (e.g.
long/async stack traces) that are too difficult to implement in Node
Inspector.

Extension downloading freezing at "checking"

My adblock extension was acting buggy, so I uninstalled it. When I went to reinstall it, it got stuck on "Checking". And it never moves past it. Whenever I try to restart the download, it says that I already have it downloading.
I've tried resetting things, I've restarted my browser, signed off of my google account. Everything I can think of and that I've seen suggested.
If anyone reads this, try turning off "Use Hardware Acceleration" in your chrome settings. Use search to find it on settings menu. Fixed the issue on my VM.
There is a discussion in the adblock forum about this issue. I don't know if you have already seen this, but I think it is worth looking at; as there are several suggestions on how to resolve this.
Try the development version.
Change the download location specified in chrome.
Check if you are logged with your users in store.
Hope this helps.
Steps to resolve:
Completely stop Chrome (you'll need to exit Chrome in your task bar even after closing the Chrome window).
Rename your Extension State directory to Extension State.bak.
Restart Chrome.
Below is the path of the Extension State directory on Windows:
C:\Users\<user_name>\AppData\Local\Google\Chrome\User Data\Default\Extension State
See Where does Chrome store extensions? for the Extension State path on other operating systems.

Run Selenium RC script on any browser that is available on user's system

I have a selenium script which i want to run on some other user's machine. I have set 'firefox' as my default browser in the selenium script.
Now the user's machine does not have 'firefox' installed on his machine.
Is there any code available that can fetch which browser is installed on that user's machine and run the script in that browser?
I want to have 3 browsers in my script like IE, Firefox and Chrome.
The script must run on any one browser which is installed on user's machine.
Any help will be appreciated. Thanks
You would either have to have some code that looks for each kind of browser (e.g. looking for the executable such as chrome.exe or firefox.exe) or you might be able to get away with some try-catch blocks that try to get Selenium to launch the browser, and treat any exceptions as 'browser didn't exist'.
I would suggest that specifically checking for each browser type is the better option though.
You could then build up a list of the available browsers and have some code to select one of them (based on some kind of priority/preference) as the target for Selenium

Resources