dmolsen / MIT-Mobile-Web

The Mobile Web Project was initially developed during the summer of 2009 and is a fork of the original v0.9 release of the MIT Mobile Web project that can still be found on SourceForge. The project was updated in May 2010. It is a product designed to make it easier for higher education institutions to deliver mobile-optimized information and services. It helps deliver task-based content like maps, events, and directory information optimized for device "families." Full documentation can be found at http://mobilewebosp.pbworks.com/ Updates to the project can be found on Twitter at http://twitter.com/mobilewebosp/
http://mobilewebosp.pbworks.com
MIT License
57 stars 19 forks source link

ios5 display issue #22

Closed jung921 closed 12 years ago

jung921 commented 13 years ago

Hi there,

I am using your fantastic code to generate some mobile web presence. When I upgrade my iphone to ios5, it changed iphone diplay. it displays smartphone look and feel not the iphone look. any suggestion would be much appreciated.

thanks!

douglasd-nz commented 12 years ago

/web/page_builder/Page.php contains a version check for the iOS version an iDevice is running: if (preg_match('/ipod/i',$user_agent) || preg_match('/iphone/i',$user_agent)) {

check to see if the ipod or iphone OS is 3 or greater for proper webkit support

    if (preg_match('/OS\ (3|4)/i',$user_agent)) {
        $type = 'iphone3';
    } else {
        $type = 'iphone2'; 
    }
} 

The problem being that preg_match does a match, not a greater than comparison, and so doesn't recognise iOS 5. A quick fix is to replace the preg_match line with:

    if (preg_match('/OS\ (3|4|5)/i',$user_agent)) {

inserting the '|5' string.

There's also a fix in https://github.com/dmolsen/MIT-Mobile-Web/pull/20