简体   繁体   中英

My clients old device won't display her website properly

For the past 18 months I've been teaching myself to code and building a website for my aunt who is a painter dianecover.com . The website works well on modern browsers and there's no issues (that I know of) but on my aunts old 1st gen iPad the pages where her images are displayed won't render correctly. I wanted to create a PHP script that could see if the browser could run my program and if it can display the main page (where I put in a lot of work) but if the browser can't it just displays an older version of the site which isn't as good but can be displayed on the older hardware. This is what I have currently that somewhat works:

<?php
// retrieves the device
$device =  $_SERVER['HTTP_USER_AGENT'];
// my issue this only works for this specific device type
if ($device == "Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1"){
    // if device type is the same display old type
    include("old_style/landscape2.php");
}
else{
    //otherwise display the new version
    include ("paintings/landscape.html");
}
?>

My problem as noted in the code is it only works on this specific device not any devise that can't run the full page. I tried chromes built in tool for identifying devices but that didn't work. What should I do? Im new to php are there any resources that I can use for this? Thanks so much for your help in advance.

Please read this article: https://www.hackerearth.com/practice/notes/detecting-device-details-in-php/

I think you will find the solution in it.

Second my suggestion is try to use some CMS like WordPress.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM