Solution: How to automatic download with os detection?

Development | Software Testing
I want to create a webpage with javascript that automatically detects which os the user has. and then download the correct installation file.

here is my code

<!DOCTYPE html>
    <iframe id="my_iframe" style="display:none;"></iframe>
     <script src="os.js"></script> 

var OSName = "Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
if (OSName =  "Windows"){
    window.location = ""
if (OSName = "MacOS"){
     window.location = ""
But the download won't start
Open os.js and delete or comment line 16.
on October 02nd, 2018 (7:40 pm)
All coments
This solution has not been commented yet.
You must sign in to comment!! LOGIN
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept