Is it possible to fire a browser's about window with Javascript? - javascript

Well the title explains my whole question. What i want to archive, is a revolutionary 'upgrade' button, that when you press it, the browser's native 'update' window pops up. If it is not present, then it create's an fake update window, so that users can update the browser.
I do not longer want to support the old IE6 browser. I want to force my users to upgrade their browser as it is insane to support a 10 year old browser.

If you are looking to get remove support for IE 6, I suggest visiting Microsof't website dedicated to the cause
http://www.ie6countdown.com/
The site contains instructions on how to place a banner on your site advising IE 6 users that they are using a very out of date browser.
http://www.ie6countdown.com/join-us.html
It informs them how to upgrade.

Nope, there is no way to do this from within JavaScript. Luckily!
I want to force my users to upgrade their browser as it is insane to support a 10 year old browser.
Fortunately, that is not possible. You could redirect users to their respective browser's upgrade page; however, I would consider that very impolite. It's not our business to force people to do anything; if your site doesn't support a specific browser, simply don't display it.
In the case of IE6, it might be justified to link to the IE6 countdown page, but consider that a lot of users have no control over what browser they use.

I don't think that's possible. You'll be better off creating your own dialog box (which looks like the IE About box) otherwise spam pages would eat our head with popping up the about dialog all the time.

Short answer, no.
It's a huge security breach to allow JavaScript to install arbitrary software. If you don't want to support IE6, don't, eventually the web will break for these users and they will be forced to upgrade, but what do you think gives you the right to dictate what software users should use?

You could use IE Conditionals:
<!--[if lt IE 7]>
<script type="text/javascript">
window.location.href = '404.html';
</script>
<![endif]-->
If they can't get to your website, they're not exactly a user of your website, correct?
Just keep in mind it used to be the other way around. It's better to be nice and warn them they may have a poor experience, than try to take over their computer. :)

Related

How to detect client's web browser is Vivaldi?

I've tried on getting browser info from javascript - navigator.userAgent, but cannot find any related string with "Vivaldi".
Please help to suggest if there are any other programming method or javascript can be used to detect Vivaldi browser?
The correct syntax in JavaScript is navigator.userAgent.
You can check window size, but it may be incorrect.
Vivaldi has its own sidebar and bottom bar that the others not.
But remember, user can change the window size to prevent detection.
According to Vivaldi, the userAgent will not have Vivaldi in it for a better user experience and mimic Chrome in all sites except a few known ones.
For the next release of Vivaldi, we have decided to try something different. The problem with our current approach is that with the web being almost infinite, we can’t possibly discover all the websites who have blocks set against us. Thus maintaining a list of sites where we present a non-Vivaldi User Agent is difficult. Instead, we will try doing the reverse. For a handful of sites where we know the label Vivaldi (and our version number) is responsibly used, we will present our full User Agent. Those sites being our own and a handful of interesting alternative search engines: duckduckgo.com, ecosia.org, qwant.com, and startpage.com. Every other site will get a User Agent that appears to be identical to Chrome.
src: https://vivaldi.com/blog/user-agent-changes/
Since you haven't mentioned your use case, assuming you are building sites, the best solution would be to do what everyone does. I recommend building websites agnostic to browsers and devices, but responsive to resolutions and feature support. Almost all of the browsers are running on Chromium these days, except Safari and Firefox (to my knowledge). So they are all going to work consistently across the board. For any given feature, one could always refer to w3c or mdn docs for compatibility and build around that.
Browser detection is also not quite reliable, as there are extensions to spoof the information. Like this extension that mimics a TV agent so one can run youtube console version on it.
On the other hand, once again I don't know your use case, one might benefit from platform detection over browser detection, like catering to mobile and TV users. Even then, if you have a site responsive enough the platform becomes non-essential information.

Browsers with JS disabled

Years ago I used to design with JavaScript disabled browsers in mind. How important is it nowadays?
Is it really something you need to worry about? I've never come across a user in real life who has JavaScript disabled. Anyone got any figures?
Having had my own company for a year and working at another for a couple of years, none of my direct clients has ever had JavaScript disabled, in one single instance I've had one of my clients customers have JavaScript disabled, so my current guess (purely anecdotal evidence) is about 1/50.000.
My biggest worry when working with JavaScript is and has always been cross browser compliance, what works in FF doesn't always work in Chrome, what works in FF and Chrome doesn't always work in IE 8, and what works in all of the above... doesn't always work in IE 7.....
And then there is IE 6.
Edit, yay data:
By July 31, 2009 firefox had 1 billion downloads
Noscript has as of September 14, 2010 73 million downloads
That tells us that about 7% of the times FF users has downloaded the browser, they have also installed the noscript plugin.
Edit addendum
Making this community wiki, add your math people.
Edit:
In October 2010, Yahoo! published actual stats.
In short, the answer varies by country, but for a US site, you can expect 2% of your users to have javascript disabled.
My tips would be:
Designing a site with a fallback to no JS is usually entirely possible and not all that difficult. You should consider doing it, regardless of what the statistics about JS-disabled browsers say.
However, don't let this stop you from being creative. If you must rely on JS and there's no workaround, don't hesitate. If someone wants full browsing experience and works with JS off, it's his/her fault.
Encoding emails using JS unescape() is always a good idea. In a JS-disabled browser, just display nothing.
You're right: straight up disabling of Javascript is pretty uncommon these days because it is used by so many sites.
However most browsers have more fine-tuned control; ie to turn it on/off per site, which may still be used by paranoid.. uh, security-conscious users.
Even more likely, there's a Firefox extension called NoScript which is actually very popular. This extension gives the user even more control over when to allow Javascript. I don't know whether there's similar plug-ins for other browsers, but I expect so.
Finally, many disabled users will be running screen-readers or other accessibility browsers which may still not run Javascript properly/at all. If you want to support these users, then you'll need to be aware of the unique environments they work in.
So yes, it is still a good idea to support non-JS users, even if they are in the minority. That said, I don't think you need to make everything work for them, as long as your basic site functionality works (ie add to basket, checkout, etc), there's no need to get too stressed about them not getting the bells and whistles.
The NoScript plugin for Firefox has been downloaded 73,063,406 times.
Your site should be usable without JS (so don't replace links with JS voodoo unless you absolutely have to).
Also people that need special output devices (like Braille Readers) will prefer sites that that work without JS.
I agree that disabling javascript is uncommon and i also agree that it's important to build websites while taking javascript-disabled browsers in mind.
BUT javascript is strongly invloved in modern & large websites now (google, youtube, facebook). without javascript you can't build AJAX supported websites and you can't also use the power of jQuery or any js library.
and if you are worry about cross browser compliance, you might wanna consider using jQuery because it abstracts away the famous cross-browser issue.
personally, i'll be always using javascript in any website i build :).
I'm a bit late to the party, but about a month after this question was asked, Yahoo! published actual stats.
In short, it depends on where your visitors are from, but in the US, you can plan on about 2% of your visitors having javascript disabled.
Here's a couple of general guidelines. People who use different browsers with accessibility in mind, or run in a terminal with no graphics toolkit (text based) are most likely to not run JavaScript. If you want to cater to these people, all you need to do is use JavaScript if you want, but only use it to enhance, not provide the content.
By this, I mean, for example, you can enhance a table by adding sort controls with JavaScript, but don't use JavaScript to parse a data file and create the table. Use a server-side program to handle a database or data file instead.
However, there becomes a grey area, and this all has to do with what kind of user base you are targeting. If you are writing a Chrome experiment then by all means, write it all in JavaScript; it's about the JavaScript.
If, however, your website aims to provide information, it's best to avoid using JavaScript to provide content wherever possible; only enhance it.

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.

How can I redirect to IE from other browsers?

I want to redirect to Internet Explorer from other browsers by JavaScript. How can I do that?
You can't.
In a standard security context, browsers provide no way of launching other programs (and a goodly number of systems don't have Internet Explorer anyway). In non-standard security contexts, most browsers still don't provide a way of launching other programs.
JavaScript does not allow you to execute programs (like Internet Explorer) from another web browser. This isn't possible.
I would recommend to either:
Show an error/warning that the site doesn't work or might not work correctly when not using IE
Fix the site to work cross-browser (recommended)
Short answer is that you can't.
The real reason is security, which will (hopefully) always prevent you from running applications on the user's computer, but even if there weren't for that reason... I'm sorry, I just have to nitpick a bit here. What you're trying to do should be absolutely unacceptable in no uncertain terms to every single user and developer. I think I can safely speak for the overwhelming majority of experienced web developers, that techniques designed to dictate to the user which browser to use are always, always, always wrong, not just technically but morally. Yes, I used the M-word. It's immoral to make those sorts of decisions for your users, no matter how dumb they are. Warn them if your site is designed specifically for a particular browser, that's fine, but don't make the actual decision for them.
Sorry, I know this ain't the place for arguing, but I do believe this needs to be clear because it's a real problem in web development that really does waste time and really does cost money and really does harm the web as a whole.
So as far as I'm concerned, I'm glad these security measures are there, because this is an extraordinarily bad idea in the first place, even without the security risks.
No disrespect intended. It just had to be said.
You can't and you shouldn't!
However, this simple javascript, which only works in IE6, can runs firefox.exe from C:\Program Files\Mozilla Firefox ( YES I KNOW IT CAN BE SOMEWHERE IN E: OR D: .... but as I know the default path of Firefox is C:\Program Files\Mozilla Firefox ... you can complete this script and find the correct path of firefox.exe)
This HELL script shows that IE6 is really insecure. ( of course it shows a warning message )
You should never 'FORCE' visitors using your favorite browser. Never ever use such script, this is just for demonstration purpose.
<html>
<head>
<SCRIPT Language="JScript">
function runFirefox() {
File="c:\\PROGRA~1\\MOZILL~1\\FIREFOX.EXE http://stackoverflow.com";
WSH=new ActiveXObject("WScript.Shell");
WSH.run(File);
}
</SCRIPT>
</head>
<body onLoad="javascript:runFirefox();">
<b>For the best experience we FORCE you using Firefox.</b>
</body>
</html>
You should just develop websites that are viewable in all common browsers ;).
No work-arounds for people using different browser types / version.
When developing websites just make sure you meet the standards and all websites have sheets for the common browsers.
You can't.
As far as I'm concerned, I'd love the other way around: redirect any user with IE6 to Firefox/Chrome/safari :-)
You can. We do it because IE has a problem with how many cookies (and how large cookie storage can be) per domain. Because we have so much in our domain we hit a wall with IE. Also, PeopleSoft does not support browsers besides IE so PS users are forced to use IE while everyone else can get locked out of other apps when they hit the IE cookie limit. Is it ugly? Yes. Horribly. It shows what happens when enough planning isn't put into a process and what happens when one group is allowed to make decisions in a vacuum without talking to other groups about potential issues. But this is a fact of life in any organization and especially smaller (size and thinking) ones where there are big egos and weak leadership. Nonetheless...
It is possible to push out to the desktop something that handles a custom mime type. Therefore, when a response goes back to the desktop of type blah/blahblah this triggers an EXE that gets the response (a target location) and fires up IE. Or milks a cow. Whatever you want. You could even use this to tell a PC to take a picture...lots of possibilities.
you can do the following:
function openInChrome(url) {
var ws = new ActiveXObject("WScript.Shell");
ws.Exec("c:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe " + url);
}

Categories

Resources