I'm wondering why isn't netscape
working using JS
if(navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) >= 4){
//netscape should work, but the code doesn't work and I get an error in the console
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
//uncaught ReferenceError: netscape is not defined
window.open(
"URL",
"Name",
"menubar=off, toolbar=off, location=off, personalbar=off, status=off, minimizable=off, resizable=off, directories=off, chrome=on, dialog=off, titlebar=no, alwaysRaised=on, close=no"
);
}else{
alert('Your browser isn\'t supported!');
}
All of the browsers (like Chrome, Firefox, Opera...) that work with Netscape return this error
Take note that the error is: uncaught ReferenceError: netscape is not defined
And for those who don't know what is Netscape, read this question's answer:
Why does JavaScript navigator.appName return Netscape for Safari, Firefox and Chrome?
EDIT:
New question, how can I get the UniversalBrowserWrite Privilege in Chrome, Firefox, Opera...?
navigator.appName == "Netscape"
is not a reliable test for support for the netscape
object. Plenty of browsers set Netscape as the appName
to work around terrible browser sniffing code. If you want to test for a feature, then test for the feature (e.g. if (typeof netscape !== 'undefined')
,
In browsers which do support it (which I think is limited to Firefox), support for netscape.security.PrivilegeManager
was removed many years ago for security reasons.