Solved

if "os" load "page"

Posted on 2014-03-26
7
183 Views
Last Modified: 2014-05-28
I'm trying to find an example of code that will allow me to detect the os ie mac or windows, so that I can load a different page for each os. Right now I have a link to a page with a streaming flv video. works great for windows, but not mac would like to detect the os and then load the page that has the video supported by that os.
0
Comment
Question by:netlinger
7 Comments
 
LVL 18

Expert Comment

by:Rartemass
ID: 39958141
If you are using html5 there are several things you can use to detect.
It may be better to detect the feature you want (ie FLV playback) rather than the OS.
Here is an article that describes what options you have.
http://www.html5rocks.com/en/tutorials/detection/

However I would probably just convert the flv into a format that can play on all platforms.
This site can help convert into html5 video. Then you won't need to worry about checking OS version or features.
http://easyhtml5video.com/
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 39958918
since we don't know know how many videos you have and if you're able to convert them, I'm not going to suggest to re-work what could possibly be a core feature of your site. Instead, I would read up on browser detection vs feature detection and see if those options are viable for what you're trying to accomplish

http://msdn.microsoft.com/en-us/magazine/hh475813.aspx
0
 
LVL 48

Accepted Solution

by:
dbrunton earned 500 total points
ID: 39959856
Use Javascript to detect OS

// This script sets OSName variable as follows:
// "Windows"    for all versions of Windows
// "MacOS"      for all versions of Macintosh OS
// "Linux"      for all versions of Linux
// "UNIX"       for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS

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";

document.write('Your OS: '+OSName);

From http://www.javascripter.net/faq/operatin.htm

See the link for full details
0
 

Author Comment

by:netlinger
ID: 39964917
reply to Raretmass

I tried that went the mp4 route. There seems to be an issue with windows xp checked multiple workstations with current browser versions of firefox and ie and I get this error:
No video with supported format and MIME type found. I defined the MIME content on the server as well.

But the mp4 videos work on win 7 and on my google tablet as well.
0
 
LVL 18

Expert Comment

by:Rartemass
ID: 39981822
You may need to add the following to your .htaccess file on the web server

AddType video/webm .webm
AddType video/mp4 .mp4

If you server uses IIS you can click on MIME types and the Add button then add the above two types. You may also want to add OGG while you are there.

If you need help adding these this article will guide you
http://coolestguidesontheplanet.com/no-video-with-supported-format-and-mime-type-found/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now