I have a website. It uses jQuery, a few plugins, Cufon, etc to spice things up a little, mostly visually.
The iPhone version does not need any of these files.
Can I, without resorting to subdomains, prevent the iPhone from loading these scripts?
<script src="js/jquery-1.4.min.js" type="text/javascript"></script>
<script src="js/browsersupport.js" type="text/javascript"></script>
<script src="js/jquery.easing.custom.js" type="text/javascript"></script>
<script src="js/jquery.color.custom.js" type="text/javascript"></script>
<script src="js/jquery.sound.js" type="text/javascript"></script>
<script src="fonts/cufon.js" type="text/javascript"></script>
<script src="fonts/trgo.font.js" type="text/javascript"></script>
Edit:
Using a library like this one: http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/
How would I go on to detect iPhone?
Browser::isBrowser('iPhone');
Returns
Fatal error: Using $this when not in object context
If the user agent indicates it’s an iPhone, don’t load them.
Update:
According to the class you referenced, this is how it should accomplish your check – I say should simply because I can see that some users commented that this wasn’t reliable for them on the blog you linked:
See Also: