Need switcher between iOS and Android devices


This code works for displaying a video on iOS devices, but not in Android:

<a href="#" onclick="'', '_blank');">

This code works for Android:

<a href="">

I need to code each video so it will switch between the two based on device detection. Something like this:

if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || (navigator.userAgent.match(/iPad/i)) {
// use <a href="#" onclick="'', '_blank');">
else {
// use <a href="">

The full html context for the video looks like:

	<ul class="pageitemvid">
		<li class="menu"><font color='"#FF0000"'><a href=""></font>
			<span class="name">A mighty Fortress is our God</span>
        	<span class="detailbutton"></span></a>

It's clear I'll need to hand-code each video instance to incorporate this device detection. My mind is awfully fuzzy at this point. How do I work this in?