add-to-homescreen icon indicating copy to clipboard operation
add-to-homescreen copied to clipboard

Issue on iPhone - Safari

Open clemorphy opened this issue 10 years ago • 29 comments

I just tested your demo page (http://lab.cubiq.org/addtohome/demos/simple/) on Safari Mobile iPhone iOS 8.1 and iPhone iOS 7.0.4 and the message didn't show up. It worked fine on Safari Mobile iPad iOS 7.1.2 and iPad Mini iOS 8.1

clemorphy avatar Nov 24 '14 14:11 clemorphy

please test the /debug/ demo. does that work?

cubiq avatar Nov 24 '14 14:11 cubiq

On the debug demo, the message shows up, but it looks like the android version of the message. There is no arrow pointing at the icon in the bottom bar, but instead it says "press the hardware button or tap the top right menu icon". But there is no such icon on Safari.

clemorphy avatar Nov 24 '14 14:11 clemorphy

yes, that is intended. can you clear your browser cache and try again? (the simple demo) remember that you have to refresh the page after the first visit.

cubiq avatar Nov 24 '14 14:11 cubiq

Does the simple demo have the "skipFirstVisit" option ? I don't see the option in the source of the demo. Is this option enabled by default ?

Because on Safari iPad, on the simple demo, the message shows up on the first visit. I don't need to refresh. On Safari iPhone, on the simple demo, the message doesn't show up on the first visit, and neither after a refresh. I cleared the cookies and data.

clemorphy avatar Nov 24 '14 15:11 clemorphy

Having the same issue here. Message doesn't show up on iOS 8.1.2.

nolybom avatar Dec 29 '14 18:12 nolybom

Tested the demo/debug also. Not working on iPhone. But it works on iPad iOS 8.1.2.

nolybom avatar Dec 29 '14 19:12 nolybom

are you testing on real device or emulator?

cubiq avatar Dec 29 '14 19:12 cubiq

Real Device(s)!

nolybom avatar Dec 29 '14 19:12 nolybom

can you post the user agent?

cubiq avatar Dec 29 '14 19:12 cubiq

Sure.

Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4

nolybom avatar Dec 29 '14 19:12 nolybom

checked on iphone 6 today. works there though.

the above described issue was/is on a iphone 5.

The user agent is on both devices the same.

nolybom avatar Dec 30 '14 16:12 nolybom

I really can't replicate this. I don't have an iphone5 to test it on and it seems to be working everywhere else.

cubiq avatar Dec 30 '14 16:12 cubiq

tested on two different iphone 5!

..and add2home-message didn't appear on both devices.

nolybom avatar Dec 30 '14 16:12 nolybom

I would need: console.log(addToHomescreen) on both devices and console.log(localStorage.getItem('org.cubiq.addtohome')) after at least 300ms that the ATH has been initiated.

cubiq avatar Dec 30 '14 16:12 cubiq

This is all so strange.

Tested on different devices and modus. Seems to work on all in private mode, but not in normal mode.

I added the console.log on all pages.

    console.log(addToHomescreen);
    console.log(localStorage.getItem('org.cubiq.addtohome'));

iPhone 5 | iOS 8.1.2:

  1. m.x.de (works in private & normal) ///// (works on iPad private & normal)

JQM 1.3.1: 2) m.a.de (works in private only) ///// site not intented for ipad 3) m.b.de (works in private only) ///// (works on iPad private only) 4) m.c.de (works in private only) ///// works on iPad normal & private

All sites have the same code:

            var ath = addToHomescreen({
               debug: false,
               fontSize: 15,
               privateModeOverride: true,
               modal: true,
               mandatory: false,
               skipFirstVisit: false,
               startDelay: 0,
               lifespan: 20,
               displayPace: 0,
               maxDisplayCount: 0,
               icon: true,
               message: '',
               onShow: null,
               onAdd: null,
               detectHomescreen: false,

            });
            console.log(addToHomescreen);
            console.log(localStorage.getItem('org.cubiq.addtohome'));

I think it maybe has to do with some indifference with

displayPace: or maxDisplayCount:

nolybom avatar Dec 30 '14 17:12 nolybom

Update:

On the site where the addtohome-message ist not showing (a + b) we get the following logs:


a: [Log] {"lastDisplayTime":0,"returningVisitor":false,"displayCount":0,"optedout":true,"added":false}

b: [Log] {"lastDisplayTime":0,"returningVisitor":false,"displayCount":0,"optedout":true,"added":false}


on the working site (c) we get the following log:


c: [Log] {"lastDisplayTime":1419999990854,"returningVisitor":true,"displayCount":60,"optedout":false,"added":false}


When opening the site a+b on safari (iMac) and changing the ua to be iphone, the log is different:


a: [Log] {"lastDisplayTime":1419999074471,"returningVisitor":true,"displayCount":4,"optedout":false,"added":false}


b: [Log] {"lastDisplayTime":1419998875683,"returningVisitor":true,"displayCount":8,"optedout":false,"added":false}


Any idea why it wouldn't recognize the lastDisplayTime and displayCount even though it is the exact same code?

nolybom avatar Dec 31 '14 04:12 nolybom

memory full maybe?

I'd also need to see the full console.log(addToHomescreen);

cubiq avatar Dec 31 '14 08:12 cubiq

It's everywhere the same:

[Log] function ath(options) {_instance=_instance||new ath.Class(options);return _instance;}

nolybom avatar Dec 31 '14 10:12 nolybom

In the iphone-settings i deleted now all the localstorage by removing all website-data. Now the message is showing. I don't think we can ask users to do that so we can show the add2home-message. ;)

How about a solution where the add2home is forced to show if memory is 'full' respectively lastDisplayTime returns 0 ?!? As you remember even the debug-mode didn't force the message to show up.

nolybom avatar Dec 31 '14 10:12 nolybom

we hold just a few bytes, it should rarely happen to fill the localstorage memory.

cubiq avatar Dec 31 '14 11:12 cubiq

exactly my thought. It can not be that this was the issue on a 64GB iPhone.

Will test on a different device where it didn't work later today.

nolybom avatar Dec 31 '14 11:12 nolybom

@macsamiro localStorage capacity is set by the browser, usually it's capped at 5MB.

I'm having the issue with the message displaying however: The message will not display on iOS 8 (iPhone 5s) using any browser. I've found that I have exactly the same results if I am in "Toggle Device Mode" using the Chrome developer console. Also, it seems that rotating the device will occasionally make the message appear.

addToHomescreen({
            skipFirstVisit: true,
            maxDisplayCount: 1,
            lifespan: 3500
        });

And my console.log:

function ath(options){_instance=_instance||new ath.Class(options);return _instance}
{"lastDisplayTime":1420566073793,"returningVisitor":true,"displayCount":1,"optedout":false,"added":false}

DaveTacker avatar Jan 06 '15 17:01 DaveTacker

"returningVisitor":true,"displayCount":1

with maxDisplayCount: 1 means that the message won't be displayed again. can you try to increase the displaycount (just for testing)

cubiq avatar Jan 06 '15 18:01 cubiq

@kneeki yes it's capped at 5MB..but per domain. Since cubiq says the script needs just few bytes i don't think the localstorage is the problem.

I tested it on a iPhone 6 iOS 8.1.1 & 8.1.2 and it works all good there...but on the iPhone 5 iOS 8.1.2 the message just does not want to appear.

nolybom avatar Jan 06 '15 19:01 nolybom

If I clear localStorage and upping (or simply removing) maxDisplayCount causes the message to display every time. If I refresh the page (without clearing) it never appears again as far as I can tell.

@macsamiro That's right. I was just trying to clear up any misconceptions since you mentioned your phone storage capacity. I may have just misread what you were talking about, so disregarding me may be a good idea. ;)

DaveTacker avatar Jan 06 '15 20:01 DaveTacker

Hello,

I'm having quiet the same issue on iOS 8. However my problem is that the popup keeps displaying on and on, whatever options I've put.

the only way to make it disappear is to remove the "var auth" code.

Here is my configuration :

var ath = addToHomescreen({ skipFirstVisit: false startDelay: 0,
lifespan: 0,
displayPace: 10080,
maxDisplayCount: 4, detectHomescreen: true });

dnizard avatar Feb 09 '15 17:02 dnizard

Any updates on this issue? I cannot get it to show at all.

mrmanishs avatar Jun 04 '15 14:06 mrmanishs

Hey @cubiq, great script mate, thought I'd add to this as I'm having the same issue as well. Like @macsamiro I can only get the pop-up to appear when the privateModeOverride is enabled, which then ignores all other settings and appears repeatedly, else it doesn't seem to work at all. For reference, am testing on both an iPhone 5 running 9.2.1 and an iPad 4 running 9.2.1. Can't post the link as it's a private beta, can email it if you want.

j-lo avatar Feb 16 '16 01:02 j-lo

@cubiq, just to update and clarify, I can now get the pop-up to appear if I control it programatically, with something like the following code:

var ath = addToHomescreen({
                autostart: false
        });
        ath.show(true);
        ath.skipFirstVisit(false);
        ath.lifespan(2);
                ath.maxDisplayCount(2);

However while the skipFirstVisit setting works, others don't. Per @macsamiro's suggestion there seems to be some possible conflict with lifespan/displayPace/maxDisplayCount?

j-lo avatar Feb 16 '16 02:02 j-lo