add-to-homescreen
add-to-homescreen copied to clipboard
Issue on iPhone - Safari
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
please test the /debug/ demo. does that work?
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.
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.
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.
Having the same issue here. Message doesn't show up on iOS 8.1.2.
Tested the demo/debug also. Not working on iPhone. But it works on iPad iOS 8.1.2.
are you testing on real device or emulator?
Real Device(s)!
can you post the user agent?
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
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.
I really can't replicate this. I don't have an iphone5 to test it on and it seems to be working everywhere else.
tested on two different iphone 5!
..and add2home-message didn't appear on both devices.
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.
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:
- 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:
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?
memory full maybe?
I'd also need to see the full console.log(addToHomescreen);
It's everywhere the same:
[Log] function ath(options) {_instance=_instance||new ath.Class(options);return _instance;}
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.
we hold just a few bytes, it should rarely happen to fill the localstorage memory.
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.
@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}
"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)
@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.
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. ;)
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
});
Any updates on this issue? I cannot get it to show at all.
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.
@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?