I'm trying to write some detection code. If user agent is iPad, then write this javascript but it's not working.
<script type="text/javascript">
if(navigator.userAgent.match(/iPad/i)) {
document.write('<script type="text/javascript"
src="photoswipe/code.photoswipe-3.0.4.min.js"></script>');
}
</script>
Any ideas?