When my website first loads it runs a small script which identifies what device the user is using.
Experimenting with this i've added in a load of old devices etc... but in turn noticed the speed of the initial load has suffered on all devices (including PC's).
If I was to, for example, write this line of code at the very top of my script:
if iPhone then go to another javascript file.
Will each device still read that, go into the javascript file and read everything, thus wasting time like it already does?
Basically will I see a boost in performance if I split up my current device recogniser script?
I understand that code runs from the top down but some devices at the top still take a few seconds to settle down, longer then usual, like they are running through the whole script because it is in one big file.
User-Agentheader and just including the correct script(s) necessary at that point? (That's what most "mobile detection" scripts do.