简体   繁体   English

检测用户是否单击添加到主屏幕

[英]detect if user clicked on add to home screen

with javascript or jQuery, is there a way to detect if the user added my site to his home screen in mobile browsers? 使用javascript或jQuery,是否可以检测用户是否将我的网站添加到了移动浏览器的主屏幕中?

i want to detect it at the second he hit on 'add to home screen' 我想在他点击“添加到主屏幕”的第二秒钟检测到它

You can try this 你可以试试这个

if(isMobile.any()) {
   alert("This is a Mobile Device");
}

And then 接着

$("#btn-id").on('click',function(){
  //Write code to get msg
)};

Mmm this should be part of the browser's functionality and is not likely to be exposed to the js on a particular page. 嗯,这应该是浏览器功能的一部分,并且不太可能暴露给特定页面上的js。

So ... I think you cannot do in within the page. 所以...我想你不能在页面内做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Web应用添加到用户主屏幕? - How to add web app to user home screen? 有什么方法可以检测用户是否已将Web应用程序添加到其主屏幕? - Is there any way to detect if a user has added a web app to their home screen? 添加到主屏幕 (A2HS) 功能检测(无用户代理嗅探) - Add to Home screen (A2HS) feature detection (no user agent sniffing) 添加到主屏幕 - ADD to HOME SCREEN 添加到主屏幕菜单链接 - Add to home screen menu link Javascript 用于 iPhone 上的“添加到主屏幕”? - Javascript for "Add to Home Screen" on iPhone? 渐进式Web应用程序:通过灯塔测试,但不会提示用户添加到主屏幕 - Progressive Web App: Passes light house test but won't promp user to add to home screen 有没有办法确定用户是否通过JavaScript中的iPhone书签(添加到主屏幕)访问了我的网站? - is there a way to determine if the user is visiting my website via iphone bookmark (add to home screen) in javascript? 如何为我的响应式网站创建链接,为移动用户(Android/iPhone)“添加到主屏幕” - how to create link for my responsive website that "Add to home screen" for mobile user (Android/iPhone) 如何检测用户是否单击了“后退”按钮 - How to detect if the user clicked the “back” button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM