Skip to main content

Add to home screen on custom button click



In the last post I had shared with you how to make the browser show a "Add to Home Screen" dialog box in Mobile devices. It is possible in both Android, iOS and even on Latest desktop browsers too. This feature is available in modern web browser and it helps us to install the PWA in user's device.

In this post we will learn how to show Add to Home Screen prompt when user clicks a button. The dialog box like the image below will popup on user's screen once they click the button designed to do that task. Below is the  Add to home screen popup dialog box.


To popup add to home screen dialog box all we need to do is -
  1. Trash the beforeinstallprompt
  2. Call deferredPrompt.prompt() when a custom button is cliked
Who wants to waste time in reading. So here's the code for you.

NOTE : manifest.json and service-worker.js file needs to be available in the same directory. Refer to last post to learn how to do that.


Check and download source code  from this link https://xbytelab.com/project/add_to_home_screen_onclick

Comments

Popular posts from this blog

YouWave Home 4.1.1 Crack

YouWave Home 4.1.1 Crack is Here !  (100% Working ) YouWave for Android 4.1.1  - The Android Emulator YouWave  is a software which is used to run the android apps in your computer and its also used to play games i.e., android games with the Desktop or laptop using YouWave .Playing with the Android emulator on your computer is a pretty geeky endeavor, but YouWave makes it easy to accomplish on your Windows PC. If you can download and install a Windows program, you can have an Android virtual machine running on your desktop in just a few minutes. Probably this is the best alternative for BlueStacks.But YouWave won’t launch most of the games like Temple Run,Subway Surfers etc. while you can play them on BlueStacks. YouWave Universal Crack ?  :  YouWave Universal Crack is Here ! YouWave Features Runs Android apps and app stores on your PC, no phone required Download thousands of apps online via app stores within youwave High performance – ...

How to Convert MBR to GPT without Data Loss?

How to Convert MBR to GPT without Data Loss? Why Convert MBR to GPT? Nowadays, many Windows users have come up with the question of "how to convert MBR to GPT without data loss". Also, in many technical blogs and forums, this question can be heard frequently as well. Why do they want to convert MBR to GPT? Let's see the  difference between MBR and GPT  as follows. The MBR hard disk can only support 2TB hard disk at most, but GPT can support 256TB. The users can only create four primary partitions or three primary partitions and one extended partition at most. The GPT can support 128 primary partitions at most. Some booting main boards can not support GPT as their system drive, such as MAC. Some Windows operating systems can not work with GPT hard disk, such as Windows 2000, XP, Windows 2003 32bit. How to Convert MBR to GPT without Data Loss? Diskpart The Diskpart Command can achieve the goal by the following steps. Step 1:  click "Start...