WordPress.org

Ready to get started?Download WordPress

Forums

MobilePress
[resolved] Safari on iOS 7.0.2 (11 posts)

  1. munkie87
    Member
    Posted 10 months ago #

    Hey Guys,

    Is anyone having troubles getting this plugin to detect the latest version of iOS 7.0.2?

    It worked perfectly fine when my phone was on v7.0, but since the update this plugin doesn't seem to be detecting.

    User agents;

    DOESN'T WORK
    "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53"

    WORKS
    "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53"

    http://wordpress.org/plugins/mobilepress/

  2. petebocken
    Member
    Posted 10 months ago #

    I am having the same problem. I just upgraded to an iPhone 5s and it's running 7.0.2 and all my MobilePress sites load the full version. Tested on my iPhone 4S running 7.0 and MobilePress works fine.

  3. Tarjanyela
    Member
    Posted 10 months ago #

    Hey there,

    I'm having the same issue - and it seems that the UserAgent-Regex doesn't work properly anymore. The new UserAgent info has changed (I compared iPhone IOS 6.3.1. and iPhone IOS 7.0.2.) and now contains "11A501". This is the cause that the "is_tablet" function in "/mobilepress/classes/check.php" returns true - although it is not a tablet.

    I've made a cheap workaround that works for me (until the next changes...):

    Instead of

    if ( preg_match( '/(a100|a500|a501|a510|a700|dell streak|et-701|ipad|gt-n7000|gt-p1000|gt-p6200|gt-p6800|gt-p7100|gt-p7310|gt-p7510|lg-v905h|lg-v905r|kindle|rim tablet|sch-i800|silk|sl101|tablet|tf101|tf201|xoom)/i', $user_agent ) ) {
         return TRUE;
    }

    I changed the code to

    // IOS 7.0.2. USER AGENT FIX
    if ( preg_match('/(iphone)/i', $user_agent)) {
         return FALSE;
    } else if ( preg_match( '/(a100|a500|a501|a510|a700|dell streak|et-701|ipad|gt-n7000|gt-p1000|gt-p6200|gt-p6800|gt-p7100|gt-p7310|gt-p7510|lg-v905h|lg-v905r|kindle|rim tablet|sch-i800|silk|sl101|tablet|tf101|tf201|xoom)/i', $user_agent ) ) {
        return TRUE;
    }

    Nothing nice, but it worked. If there are better solutions to this problem I greatly appreciate it!

  4. marcbkk
    Member
    Posted 10 months ago #

    Sadly it doesn't work on my blog anymore either either on my iPhone running iOS 7.0.2 or on my friend's Samsung Galaxy S4. So it seems the problem isn't limited to iOS7. I can't recall when it stopped working on my iPhone, whether it was iOS6, iOS7, but it was recent. Within the last couple of weeks. It also doesn't seem to load on my Samsung Galaxy Tab 2 either, which is an only tablet.

  5. petebocken
    Member
    Posted 10 months ago #

    Thanks Tarjanyela! This fixed it for me on all my sites.

  6. Tarjanyela
    Member
    Posted 10 months ago #

    @marcbkk: in my case, it worked for me with IOS 7.0., but not with IOS 7.0.2.
    You say the problem exists with samsung, too? Could you post the user agent info? So it's possible that we still have this issue on other devices...? I don't have any other tablets, so I can't check it. But it would be good to know if any other devices don't work properly either...

  7. marcbkk
    Member
    Posted 10 months ago #

    @Tarjanyela - Thank you. I was actually already thinking along the same lines of your question before you posted it and I looked into some Java script that runs on my main web site for detecting mobile devices. The following script detects all forms of mobile devices regardless of operating system version and never needs updating when new versions of mobile device operating systems are released. The script runs fine and has never had any problems for obvious reasons. The script actually directs them to an entirely separate mobile version of my site instead of just a mobile theme, but perhaps the script could be adapted into some code which would work with MobilePress to redirect the mobile device users to http://yourwebsite.com/blog/?mobile.

    The Java script is as follows:

    <script language=javascript>
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/webOS/i)) || (navigator.userAgent.match(/android/i)))
    {
    location.replace("http://yourwebsite.com");
    }
    </script>

    Perhaps you can do something with it to create a workaround solution. Cheers.

  8. munkie87
    Member
    Posted 10 months ago #

    I finally came to a similar solution after taking the wrong assumption that the word 'iphone' would be detected under the phone detection before it got to the tablet detection.

    In iOS 7.0.2, the user agent part "11A501" is picked up by "a501" under the tablet detection. It's only doing a partial match, not an exact match.

    We don't need tablet detection on our sites so we just pulled out what we didn't need.

    Original:

    if ( preg_match( '/(a100|a500|a501|a510|a700|dell streak|et-701|ipad|gt-n7000|gt-p1000|gt-p6200|gt-p6800|gt-p7100|gt-p7310|gt-p7510|lg-v905h|lg-v905r|kindle|rim tablet|sch-i800|silk|sl101|tablet|tf101|tf201|xoom)/i', $user_agent ) ) {
         return TRUE;
    }

    Revised:

    if ( preg_match( '/(ipad|kindle|rim tablet|tablet)/i', $user_agent ) ) {
         return TRUE;
    }

    We couldn't see any issues on Samsung devices, though removing all the unwanted matches may solve the issue.

  9. marcbkk
    Member
    Posted 10 months ago #

    Sorry for the Newbie question, but which file needs to be edited on this code? I am not sure which one to go to in MobilePress as I see there are many files for the plugin. Cheers.

  10. munkie87
    Member
    Posted 10 months ago #

    Hey marcbkk,

    /classes/check.php

    I modified line 99 into:

    if ( preg_match( '/(ipad|kindle|rim tablet|tablet)/i', $user_agent ) ) {

    Hope this helps.

  11. marcbkk
    Member
    Posted 10 months ago #

    Thanks. That did it. Now works on all devices. iPhone (iOS7.0.2), Samsung Tab 2, and Samsung Galaxy S4. Excellent!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.