Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var matchesOSPrefix = function(prefix) {
- var pre = prefix.toLowerCase();
- var platform = window.navigator.platform.toLowerCase();
- return platform.indexOf(pre) === 0;
- };
- var windows = function() {
- return matchesOSPrefix('Win');
- };
- var mac = function() {
- return matchesOSPrefix('Mac') || matchesOSPrefix('iP');
- };
- if (windows()) {
- // Display PS Command
- console.log('Windows');
- } else if (mac()) {
- // Display OSX Command (curl)
- console.log('Mac');
- } else {
- // Display Linux Command (curl, wget?)
- console.log('Linux');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement