Detect if private browser session is on Firefox with Javascript - javascript

I'm working on Rails app and I need to detect if I'm on Firefox private session using Javascript code or some JS plugin.
I'm testing on Firefox 43.
I was trying using Components.classes but this is undefined. The problem is like Firefox on private session uses Tracking protected, this is not loading some JS files and I need to know if I'm on private session (then Protected Tracking is enabled), and then, I'm not going to load this tracking JS files.
Thanks in advance.
I saw some posts to check if we are in private session on Chrome and Safari and these work well on these browsers but don't work on Firefox!

I believe that there is no truly reliable way to detect private browsing. That said, I've used this in the past, and it worked quite well for me!

Related

Script errors in C# webbrowser control

I am developing a Twitch chat bot and I want to be able to display the current chat in the bot using a webbrowser control. I get "An error has occured in the script on this page. URL : https://web-cdn.ttvnw.net/sw.js"
I can get it to work with gecko or cefsharp web browsers, however; they are way too big. I want to keep my application under 10mb.
Is there anyway around this?
The Script file(s) (.js) on your website should be at bottom of the html file and then after (If you have access to it)
Add meta query to support in IE
The query is
I hope this will help!
I recently moved over to using WebView2 to solve this issue.
https://learn.microsoft.com/en-us/microsoft-edge/webview2/
It uses the Edge browser as base and it works perfectly. The browser-code is very similar to the old WebBrowser as well.

Chrome extension private API?

Hello I would like to use networkingPrivate api, which one is from chrome private API, I have added permission for networkingPrivate but it seems that is not enough. Also I found this
These are only usable by extensions bundled with Chrome, they are not publicly accessible.
here: https://developer.chrome.com/extensions/private_apis, but I'm not sure what that exactly mean, and how to do that.
My original intention is to get info about wifi (ssid,...)?
Thanks
It would be a security risk to allow user extensions to access this information direct from the OS. I think the private API is for Chrome OS, so that you can access and modify OS features direct from the browser, since Chrome OS is basically just a browser.
You could try looking at Native Messaging, which I believe will allow you to connect your extension to a native application installed on the host's machine. The application written by you would have some link between the extension, and then you can pass messages between the two. For example, your extension could request network information, and the native app will get that and send this information back to the extension.
I haven't looked into this so I may be wrong, but worth investigating. I'd be very interested to see the result.
Private APIs are made for internally usage.
For example, DeveloperPrivate API is used on chrome://extensions page.
They have stronger power than other APIs. but they also have security issues if they are open. if you really need to use them, just ask to make new API.

Google Chrome Custom URI-Scheme redirection to JS

I am currently working on a custom uri-scheme (protocol) in google chrome and require a method to automate some testing (and development) of this protocol purely from within the chrome browser.
For example. If a redirect/anchor link points to this example uri
testuri://thismessage/additionaldata
then I would like to to redirected back into JS somehow. I.e. with a call to say
function protocolMessage(data) { ... }
I have explored the use of 'navigator.registerProtocolHandler' but that requires the use of 'web+testuri', which isn't an option (unless someone knows of a setting that can be used to turn this off).
I have investigated using a chrome custom extension to capture the uri under webNavigation but it doesn't capture anything but http(s) schemes. And I cannot see any functions that would allow me to register a custom scheme directly either.
Further investigation led me to try calling out to a system application (using custom uri-schemes that call native executables) and this partly works but now i'm stuck on how to redirect that message back into the current page/tab's javascript.
I also had a look at NaCL (Pepper API's) but that doesn't seem to allow registration of custom schemes either.
I am hoping for a better solution than calling out and back into the browser, but if not can anyone shed any light on a good solid reusable solution?
Any ideas?
Thanks in Advance
To my knowledge, no, sadly.
All Chrome APIs work with "supported schemes" and you can't add one.
web+custom: is also an inflexible limitation.
If you have a system application, you can talk to it by either providing a WebSocket server in the application, or working with Native Messaging.
The problem with native messaging is that Chrome has to initiate the connection to a new instance of the Native host. So you'll need to be able to handle the native app being invoked separately for protocol handling and for messaging.

Firefox 29+ UI components disappear in private browsing

I created a Firefox extension that consists of a ui/toolbar from Firefox's newest Addon SDK. I gave the extension permission for private browsing in the package.json of the extension.
When I set Firefox to use "Permanent Private Browsing", the extension disappears.
Does any one know how to allow the new ui components to be used in private browsing mode from startup? Configurations to the browser and/or extension?
This is a known bug, namely https://bugzilla.mozilla.org/show_bug.cgi?id=1026614
There are no viable work-around besides patching the SDK yourself. But I wouldn't recommend that if you want to host your add-on on AMO ; add-ons using a modified SDK will be rejected.
Your best bet is waiting for the bug to get fixed.

Does Mobile Safari clean the DOM Application Cache - and when?

We're doing a web app using the DOMApplicationCache / cache manifest, and I'm wondering if Mobile Safari at any point will clean/clear the DOMApplicationCache for my project (eg. if the website is not visited in a certain amount of time).
I'm also told, that saving the web app to the home screen will sandbox its application cache, effectively avoiding any time constraints there might be on the DOMApplicationCache in "normal" Mobile Safari.
So do anybody know what the current situation is on this? Or would you maybe be able to point me to a relevant resource?
Thanks!
It doesn't seem like it should be clearing the cache automatically, from what I can read in Apple's document about storing web content on the client: https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/Client-SideStorage/Client-SideStorage.html#//apple_ref/doc/uid/TP40002051-CH4-SW5
However, I would probably implement a measure to ensure that the cache is valid and exists using the status property of the applicationCache object. If you haven't already, check the class reference here: https://developer.apple.com/library/safari/#documentation/DataManagement/Reference/DOMApplicationCacheClassReference/DOMApplicationCache/DOMApplicationCache.html#//apple_ref/javascript/cl/DOMApplicationCache

Categories