I'm writing a Safari extension and want it to behave differently when the user turns on Private Browsing mode (I want to respect this private mode).
I found no mention of this in Apple's docs.
I'm aware of the discussion in this thread:
Detecting if a browser is using Private Browsing mode
which suggests using a (browser-agnostic) js-CSS trick to detect private-browsing mode, but was hoping there's some hook built in to Safari that I could use for my extension.
Any ideas?
Although Safari has a "Private" mode, Safari does not disable add-ons by default in private mode. However, Safari has a very simple setting to turn off all extensions. In the "Preferences" window, select "Extensions" and choose the "Off" option.
You can quickly tell if you are using Private Browsing as the url/search bar will appear with a dark theme instead of white or gray for standard windows. Also, the white highlight around Private shown above on the right) means it is turned on. Tap the + symbol at the bottom middle of the screen and start browsing.
The answer is no. Private browsing does not guarantee security and can easily be traced. As stated above, if you turn on Private Browsing on your iPhone, the details of your browsing will not be saved on your iPhone. This means that anyone else who uses your iPhone will not know your online activity.
You can query the boolean safari.application.privateBrowsing.enabled
to check if private browsing is enabled or not.
You can also attach event listeners to trigger custom code when private browsing is activated or deactivated.
safari.application.privateBrowsing.addEventListener('activate', function(e) {
console.log("Private browsing activated");
});
safari.application.privateBrowsing.addEventListener('deactivate', function(e) {
console.log("Private browsing deactivated");
});
Source: Apple Docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With