document.write is long dead.
All browsers running on a computer will run flv/swf video - provided the plugin is installed - when attached using an object tag. To add native video support for browsers that support one of the three native formats you wrap a video tag around the object tag.
It isn't possible to identify any particular modern browser. The most recent browser that can be positively identified is Internet Explorer 8 as that was the last browser that allowed conditional statements to check the browser version.
<video width="300" height="200" poster="movie.jpg" controls>
type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
type='video/webm; codecs="vp8.0, vorbis"'>
<source src='movie.ogv' type='video/ogg; codecs="theora, vorbis"'>
<object data="flashmovie.swf" width="300" height="200" type="application/x-shockwave-flash">
<param name="src" value="flashmovie.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<param name="wmode" value="transparent">
<p>Fallback content for browsers that don't support either video or flash goes here.</p>
All browsers can spooof that they are other browsers by placing appropriate content in the useragent field - for example all spoof that they are Netscape by adding the word "Mozilla" in the useragent as that was what Netscape 1 used to identify itself. People can set the useragent in their browser to anything. For example IE, Firefox and Chrome can all be set to use the following useragent which identifies it as ten different browsers at the same time:
Mozilla AppleWebKit KHTML Safari Chrome Firefox MSIE 99.0 Trident Opera Android