Hi, I using a script to make my site viewable on touch screens, the site works perfectly on all browser expect IE9. I want to make sure the script is only loaded if visitor is using an iphone or ipad. thanks
Hi thank you for the reply, not sure where I should insert it to my header. I notice you only have "ipad", is that sufficient to also include iphone? This is what I would like to tell iphones/ipads to run <script type="text/javascript" src="script/iscroll.js"></script> <script type="text/javascript"> var myScroll; function loaded() { setTimeout(function () { myScroll = new iScroll('scroll-pane', { zoom: true, snap:true, hScrollbar: false, vScrollbar: false, zoomMax: 2, momentum: true }); }, 100); } window.addEventListener('load', loaded, false); </script> PHP: thanks
<?php $agent = array('ipad', 'iphone'); foreach($agent as $ary){ if(in_array($ary, $_server[http_user_agent])){ //this is a iphone or ipad } } ?> Hard to write code on a tablet, syntax might be off, but should give you a good idea.
Thanks knewedge, I asked over at the javascript forum and someone gave me a complete code in js, which did everything I needed. If anyone is interested, here is the link http://forums.digitalpoint.com/showthread.php?t=2374616#post17206261