Detect when Firefox plug-in is blocked - javascript

Is there a way through JavaScript or a web service to see if a plug-in installed in Firefox is being blocked by Mozilla? In particular, on my web site, I want to be able to tell if Mozilla is blocking an outdated version of Adobe Flash and adjust our UI accordingly.

The address that Firefox uses to download the blocklist is defined as extensions.blocklist.url preference:
https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/
Fortunately, not all of these parameters are required, this address will work to download the current blocklist:
https://addons.mozilla.org/blocklist/3/%7Bec8030f7-c20a-464f-9b0e-13a3a9e97384%7D/21.0/
This is the ID of Firefox and the version number of the current release, so the blocklist could be different for other Mozilla applications and other Firefox versions. Looking through https://addons.mozilla.org/blocked/, there are some items listed as "for Firefox version n.n.n and higher", some are listed as "for Firefox and SeaMonkey" and others again as "for all Mozilla applications". Still, it seems that the blocklist for the current Firefox version should be the most complete one.
You can download and process this file in a web service, then adjust the behavior of your web application accordingly.

Related

Why does Google hangouts support sharing desktop without Chrome Extension in latest Chrome?

As far as I know, in browser, such as Chrome, sharing desktop or application needs a Chrome Extension to work, eg:
chrome.permissions.request({
permissions: ['desktopCapture'],
}
But why does Google Hangouts do not need any extension to capture desktop?
Is there any API of JavaScript for this?
As of now, Google Hangouts does use an extension, it's just integrated into Chrome to the point of not being visible.
Source: Chromium issue to remove this special treatment
You can test that it is (stealthily) installed by manually opening
chrome-extension://nkeimhogjdpnpccoofpliimaahmaaome/background.html
At the same time, work is ongoing to support WebRTC spec for screen sharing (getDisplayMedia) in Chrome. It's not yet enabled by default in released Chrome versions, but will be very soon (code is already in the codebase).
Implementation tracking: Chromium issue

Change browser from Edge to IE with Javascript

I'm working on a website where (due to security settings in the users Windows desktops), the users cannot use the Edge browser.
Is there a work-around where I can 'redirect' the website to use Internet Explorer? In other words, ask it to perform the equivalent of run Internet explorer as an app and go to the same URL?
We will fix the issues on the website, but I don't want to get into the issues here, thanks.
-----edit-----
In this case the users have pre-packaged Windows 10 with non-standard security settings for Edge. Sadly I don't have control over the windows build and in a large company there are a number of hurdles before the corrected settings can be applied.
It's all well and good to let users choose their own browsers in normal situations, but in this specific case a solution is required.
I am happy to create a temporary "please use Internet Explorer page" but I was hoping a mime application type or other solution could suggest to the windows pc to run IE along with the same url the user is first accessing to make this more seamless.
Sites can't control whether to use IE11 or Edge, however Microsoft does allow specific sites to be white listed to only use IE11 using Group Policy. Here is Microsoft's page talking about it: https://technet.microsoft.com/en-us/itpro/microsoft-edge/emie-to-improve-compatibility

Web MIDI API not implemented in Chrome Canary?

Support for the Web MIDI API has been added to Chrome Canary since early 2013.
Why then, when I type requestMIDIAccess in the JavaScript console and hit enter, do I get "ReferenceError: requestMIDIAccess is not defined"?
According to official documentation, it should be a defined function.
What gives?
The Web MIDI API is available by default only in Chrome versions 43 and newer.
In earlier versions it is not enabled by default, but can be enabled as an experimental feature flag. In Chrome, load the special URL chrome://flags and search within the page for "Enable Web MIDI API".
The options on the flags page require the browser to be restarted before they will take effect. The features hidden behind these flags are in an experimental state and are subject to change at any time, so the API in older versions may differ from what is available in Chrome 43.
Note also that the requestMIDIAccess function is a method of window.navigator, not directly of window. Therefore you need to call it as navigator.requestMIDIAccess.
Also note that after you plug-in a new MIDI device, you may need to quit and restart Chrome. It does not seem to handle dynamic adjustment of the device list.

JavaScript Injection using Firefox Mobile

I would like to inject JavaScript into a website on a mobile browser (in this case on android). However, most mobile browsers do not seem to support any kind of plug-ins (except for Firefox, correct me if I am wrong).
Firefox support for mobile plugin development seems to be minimal too, for example one can not install xpi-files by downloading them (I have yet to find out how one can install a plugin that is not hosted on the add-ons for android site)
Why not use existing solutions?
The best way to inject javscript would be Greasemonkey but this is not supported on mobile. Scriptish supposedly is but I could not install it on any device. There are android browsers specifically written to support Greasemonkey scripts (Fat Ape or Tampermonkey or OilCan) but these are not used by many and while they enable JavaScript injection the lack in their support for other browser-features.
What exactly is my question?
My experience in Firefox-Plugin development is minimal so I would like to know: Is there something that would prevent something like this to run on FF-Mobile? Could it be done with other browsers too? I don't actually need the full power of Greasemonkey, injecting the same few lines into any website would probably do.
Update 2
This again needs updating!
The new Firefox (current 95.2) no longer supports this method! But the old version still does! You will have to DL an old version (let's say 68.7). You can get it on ApkMirror. Then to install Greasmonkey either google it and choose the Mozilla page or just visit this link. On that page choose to download the file. When the XPI file will be downloaded it will automatically request to install it and that's it. You now have Greasemonkey installed on your Android device!
Be advised that this is an old unsupported Firefox version full of security holes!
Update
This needed updating!
The new Firefox now has full support for Greasemonkey add-on!
Instructions:
Find and install Firefox on the play store.
Run it and from the menu choose Add-ons and install your favorite add-ons like the ad blocker uBlock origin. Use the search and input Greasemonkey and install it.
Profit! :)
Old
If you want full Greasemonkey with even cross domain / cross site
GM_xmlhttpRequest support then your only option right now is: Opera
Mobile Labs (with Extensions) (link to APK is on that site).
Run Opera Mobile Labs app and visit Violent Monkey's extension
site and install the 1.5.1.1 (OEX version) by clicking on "Add to
Opera" and then choose "OK" (maybe you'll have to restart Opera
Mobile for the extension to work.).
To install an userscript you just need to load it in the browser by
visiting the user.js URL location. If you have userscripts on your
SD card, you can load them thru entering "file://" into the address
bar and navigate to your user.js files and then choose "OK".
If you have a bunch of normal scripts (no GM_ functions) then you
could also use this instructions (it's faster!):
Save your user.js scripts in a folder on your SD card (eg. "/sdcard/js").
Run Opera Mobile app and enter "opera:config" into the address bar and then in the "Quick find" input enter "javascript". Go
down and under "User Prefs" tick the following: "Always Load User
Javascript" and "User Javascript". Under "User Javascript File"
enter the path to the folder with your user.js files (eg.
"/sdcard/js").
At the end don't forget to tap "Save" otherwise your setting will not be saved! Restart Opera!
If you don't want to download the APK file then this second method
also works with Opera Mobile Classic. You can find the app in the
Play Store.
If you can install Google Chrome (Android > 4.0) on your mobile phone you can do remote debugging.
Overview of Google Chrome for mobiles :https://developers.google.com/chrome/mobile/docs/overview
Overview of Remote Debugging: https://developers.google.com/chrome-developer-tools/docs/remote-debugging
Another option for running Userscripts on mobile devices is the Tampermonkey userscript manager.
There are Tampermonkey add-ons for both the Dolphin and UC Android browsers.
Tampermonkey add-on for the Dolphin Web Browser:
https://play.google.com/store/apps/details?id=net.tampermonkey.dolphin
Tampermonkey add-on for the UC Web Browser
https://play.google.com/store/apps/details?id=net.tampermonkey.uc
To use them you first need to have the respective browser installed.

Any Javascript functions to get homepage ,search provider ,favourites etc from browsers like Firefox and google chrome

my application is setting browserhome page ,search provider ,favourites etc to all supported browsers like googlechrome,firefox,internet explorer.My purpose is to automate my application using selenium .In case of IE these informationa are stored in registry . so it is easy for me to validate the above details .But for firefox and google chrome its bit problem .So i just want know whether there is any functions available in javascript to check browser homepage ,search provider,favourites etc in firefox and google chrome ?
The simple answer is no. It would be a security and privacy issue if client side js code could access that information. Instead you would need to use a browser extension, or in your case you can just use an external program with administrative rights. I am pretty sure that selenium does not have this functionality built in, however it is all available if you know where the browser stores it. IE uses the registry, but chrome and Firefox use proprietary files in their profile directories. There may be an library that does this, otherwise it is possible

Categories

Resources