Loading Mobile/Desktop Headers Dynamically
-
Greetings,
I’m working on a theme framework and need a fresh set of eyes – what are your thoughts on the following process:
– User agent detected when visitor reaches the site (via: detectmobilebrowser.com)
– Different header information included with simple PHP (files within template folder)
– Generic closing</head>
tag and life resumes at normal pace!So the code looks like this:
<?PHP detectmobilebrowsermagic ?>
if mobile useragent: load <html>...</head> for mobile users
else (desktop useragent): load <html>...</head> for desktop users
Does this make sense, what are your thoughts on speed vs. functionality, etc. I’d love to hear any thoughts or comments on the process! If you’d seen anything like this I’d really enjoy reading their documentation as well.
Counterpoint – I read this article about using PHP for browser detection, but the main argument seems to be centered around “you need to keep it updated” which I’m planning on for this framework: https://www.impressivewebs.com/php-browser-detection/ Can anyone think of another reason why I might not want to keep this function within PHP?
I think this is a fun way to quickly swap between two versions of the head code without a lot of overhead and client-side scripts, which ought to speed up the mobile experience quite nicely.
Thanks in advance for your thoughts!
- The topic ‘Loading Mobile/Desktop Headers Dynamically’ is closed to new replies.