firefox disable/enable add-on in a specific page - javascript

I'm programming a system to work with in firefox, based on high end javascript.
The users sometimes uses add-ons that conflict with the system.
Is there a way i can control from my web-site to disable or enable specific firefox add-ons in a page?
Thanks.

You can do it inside an add-on, prior to Firefox 4 there was the nsIExtensionManager interface, starting with Firefox 4 there is the AddonManager object

I would say no, I wouldn't want sites I browse doing anything to my browser add-ons unless I said they could.
With things like Firebug you CAN detect them though and warn the user, then it's down to them to turn them off and not you.
And here's another thought...imagine me turning off your Adblock because my site doesn't work well with it ;)

Related

Can firefox's multi-account containers extension be replicated in chrome or chromium based browsers?

I love the firefox extension multi-account containers. I want to switch to brave browser but I can't find a good alternative. Is it a functionality that can only work in firefox due to API limitations or is it possible to implement it in chromium based browsers via an extension?
If I want to create this extension can I make it exactly the same as firefox's multi-account containers? I tried to load the extension into brave but it has many errors due to the differences in the APIs I think. So the only way to do this would be to program it for chromium. Is that possible?
I found this reddit thread https://www.reddit.com/r/brave_browser/comments/kw2cff/brave_alternative_to_firefoxs_multiaccount/ it appears to suggest that containers are firefox exclusive and sessionbox is an alternative suggested. I tried sessionbox though it appears to be limited to having to click on the extension and then select a session to start the website in while multi-account containers can do that automatically if you set it to always open in container.
Are there extension API features that such an extension makes use of and chromium based browsers don't have?
Maybe this feature can be implemented not through an extension but directly through the browser, as brave is open source it should be possible for me to add this feature or fork it and add it there.
[this question is a duplicate of another question I asked; an attempt to make it more clear; I removed the other question]
Multi-account containers functionality requires Contextual identities browser extension API and which is only supported in FireFox.
As for 2023, it's not possible to implement FF's multi-containers in Brave/Chrome.
But you can spread the word and vote for this feature here:
https://community.brave.com/t/equivalent-of-multi-account-containers-or-temporary-containers-extension-ff/135573
It's not a lost cause but this feature has been discussed by Brave's team since their launch, about 5 years ago:
https://github.com/brave/brave-browser/issues/34
Their conclusion is that is too much work. They say this feature has to be implemented by Chrome first, otherwise they have to patch too many things.
The problem is that Google won't ever implement something like that in Chrome, IMO. The whole idea goes against their core business: track users for targeted advertisement.
There are some plugins you can give a try, but they are not practical (in my opinion). Also, I wouldn't trust a plugin to access all my browser data (history, cookies, etc).

Does Firefox have a standard API to check installation of specific Addons?

I'm trying to detect the presense of certain addons that restrict functionality on our sites (such as Ghostery, or DoNotTrackMe), using plain JavaScript. If Firefox had a standard API to query for the existence of addons, it would short circuit my work. Probably something like:
AddonManager.getAddonByID('?')
Detection is possible for plugins such as Java and Flash (navigator.plugins), but not for addons, yet.
Detection is also possible if you are the developer of the addon.
No, there is no such API and there won't be. If the browser allows websites to detect what extensions are installed then it is a bug and a privacy issue - Firefox and Chrome fixed such issues in the past, currently no such issues are supposed to exist. Why webpages shouldn't know this:
The add-on list allows fairly precise fingerprinting of users and might allow tracking users even if cookies and similar mechanisms are disabled.
Attacking vulnerabilities in extensions gets a lot simpler if a website can check in advance whether a vulnerable extension/extension version is installed. Same goes for social engineering attacks that rely on the presence of particular extensions.
There is always a chance that websites decide to exclude website visitors that have unpopular software installed (ad blockers of all kinds, vulnerability scanners, download helpers etc).
The list of installed extensions tells a lot about the user, his browsing habits and preferences - providing this information to websites would be a huge privacy issue.
navigator.plugins functionality shares many of the same issues of course - it was introduced in the dark ages of the internet back when nobody considered such issues. This is the reason why this functionality is being actively discussed and might get limited in future.
Now of course websites can still try to detect extensions by their effects. However, this isn't a very reliable approach, e.g. the Adblock detector you linked to says "no ad blocking detected" to me and is clearly wrong.
Bonus info: Google Chrome does provide a list of installed extensions but only to a single website: Chrome Web Store. The Web Store uses it to indicate which extensions you already installed. Whether it does anything beyond it with that data is something where your guess is as good as mine.
You can detect AdBlock in FF, IE, Chrome
http://adblockdetector.com/
You can detect FlashBlock in FF, IE, Chrome and others
https://gist.github.com/artlung/1420308
https://github.com/browserstack/flashblock-detector/blob/master/flashblock-detector.js
You can detect Ghostery in Chrome
http://blog.securitee.org/?p=277
Please note these scripts use inference to detect the presense of these addons, there's no API. I haven't found detectors for other addons but they possibly exist.... (ongoing)

Prompt user to "Open firefox" if the website is opened in "IE"

I have a website,which is "currently" designed & tested to work only on firefox.If user tries to open it in other browser then I want to show a popup saying "This site works best with Mozilla Firefox. We're working hard to add support for your favorite browser. Meanwhile, do try it with Firefox."
Can we provide a buttion on clicking of which, one new window will be opened in firefox preloaded with some URL ? and also tells us in case firefox is not available at its default location ?
Thanks,
Sourabh
If you make your website standard-conformant, chances are pretty high it will work in Firefox, Opera and WebKit-based browsers (Safari, Chrome), without having to use much browser-specific code. Problem is, as usual, with IE. To achieve best results, write a website for standard-compliant browsers, then add hacks to make it work in IE.
You cannot detect installed applications on client computer, nor launch any of them - beacuse of security. All you can do is to do browser sniffing. You can do it on server side (by examining User-Agent header), or on client side (using JavaScript to check window.navigator object). It is quite complicated and error-prone though and certainly not forward-compatible (future browser versions may confuse your scripts). Moreover, users can change their browser's identification. When you detect unsupported browser, you could display some popup asking user to switch browser.
If you want to detect only IE, you can use IE's conditional comments, which is a most reliable way for detecting IE.
You can't test for Firefox being available nor start it using JavaScript. That would create big security holes...
You can try to figure out if the current browser is Firefox and output a message, although I really hate them (remember that not every visitor will be able to install/use another browser, e.g. within companies or public places).
If it only works on one browser, it isn't a website.
Sometimes we have to rush our work and compromise, but there is a cut-off point where more time is the only sensible option. Making your website multi-browser-compatible is one such example.
However, if you have to detect the user's browser, you could look at quirksmode. Mozilla have good article on browser detection, and the related issues.
A better alternative to browser detection, would be feature detection and Modernizr is very good at this.

Is there a way using jQuery or Javascript to force a page to open in Firefox?

Is there a way using jQuery or Javascript to force a page to open in Firefox? For example, if the user has their default browser set to internet explorer, but they have firefox on their computer - open a new firefox window with the intended page. If so, I would need to check to see if they have firefox on their machine; otherwise, redirect to the mozilla firefox download site...
any suggestions?
The answer, simply, is no. They don't have file system access like that for security reasons. You can probably imagine what would happen if, say you wrote a program that could crack open QuickBooks and take a look around. If you're worried about compatibility, you can use JavaScript checks to notify them that your page needs to be viewed with Firefox and refuse continuation until they get that settled.
http://www.quirksmode.org/js/detect.html
Or, you know, do it the old fashioned way and build a web page that is cross-browser compatible.
Alternatively, ActiveX might be able to do it, but the user has to accept permissions, and this is highly shady activity.
No. Web browsers do not provide information on other applications installed on a system. It would have security ramifications, such as presenting a fake McAfee antivirus dialog to folks who had McAfee antivirus installed.

Internet Explorer Debug Mode - Is there a quick way to enable/disable it?

I do web site debugging with Internet Explorer (as well as other browsers), but my problem is with Internet Explorer, as it is the browser I usually use for regular browsing.
In order to debug you need to turn on debug mode in the advanced options. OK, fine. It's turned on. But the issue I have, that is quite annoying, is that it seems 30% of websites have JavaScript errors, and Internet Explorer in debug mode causes a popup. This is now also the case with Stack Overflow as well, where I spend a lot of time now. Every time I edit I get a JavaScript error pup up.
I guess it comes down to this: Is there a way to QUICKLY enable and disable debug mode, such as a Hokey, or an add-in, so you don't have to go into Advanced Options to enable and disable?
I should mention I do mainly ASP.NET development and use Visual Studio. I do already use Firefox/Firebug for some scenarios and non Internet Explorer-related issues. I'm not really looking to switch around what I do or how I do it, mainly looking for a solution to the problem at hand. Even a workaround that doesn't involve using other browsers/debuggers.
The quickest way I can think of would be to write a small utility to:
Close all IE windows
Toggle the REG_SZ registry value HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger (from "yes" to "no" or vice versa)
Optionally restart IE
As far as I know, there's no way to make IE recognize the changed registry value without restarting it, even using an IE plugin.
As an aside, unless the IE/VS integration is critical for you, you may want to look into the combination of Firefox and Firebug for Javascript debugging: I find it much nicer in general, and debugging can easily be enabled or disabled, either interactively or on a per-site basis.
I recommend using Firefox + IE Tab, which would allow you to easily and quickly change the rendering engine used for sites that require IE. This way the bulk of your browsing can be done in non-IE tabs and you can avoid the debug popups.
Have a look at debugbar. It's free for personal use, and it has a 60 days trial for commercial. It works a bit like fireug for Firefox, but obviously it's going to cost to use.

Categories

Resources