Add to home popup

This topic contains 3 replies, has 2 voices, and was last updated by  Alex Rollin 6 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #460552

    Leonardo Guastella
    Expired Member
    Post count: 164

    Tô do this add to home popup thing I need to add some code to my page

    I don’t know much about child themes and etc
    Do I need a child theme to add this code and then this will be preserved in case of update?

    >>
    I found this detailed article on Medium. How to add “Add to Homescreen” popup in web app

    Step 1: Create a blank service-worker.js file in your root folder. And put the below code in your html page, before closing tag.

    <script> if (‘serviceWorker’ in navigator) { console.log(“Will the service worker register?”); navigator.serviceWorker.register(‘service-worker.js’) .then(function(reg){ console.log(“Yes, it did.”); }).catch(function(err) { console.log(“No it didn’t. This happened:”, err) }); } </script>

    Step 2: Create manifest file create manifest.json file in root folder. Add below tag in your html page header section.

    <link rel=”manifest” href=”/manifest.json”>

    Step 3: Add configurations in manifest file Here is the configurations sample.

    { “short_name”: “BetaPage”, “name”: “BetaPage”, “theme_color”: “#4A90E2”, “background_color”: “#F7F8F9”, “display”: “standalone”, “icons”: [ { “src”: “assets/icons/launcher-icon-1x.png”, “type”: “image/png”, “sizes”: “48×48” }, { “src”: “assets/icons/launcher-icon-2x.png”, “type”: “image/png”, “sizes”: “96×96” }, { “src”: “assets/icons/launcher-icon-3x.png”, “type”: “image/png”, “sizes”: “144×144” }, { “src”: “assets/icons/launcher-icon-4x.png”, “type”: “image/png”, “sizes”: “192×192” } ], “start_url”: “/?utm_source=launcher” }

    In the above code, you can replace your own values.

    short_name: This name is visible on Homescreen along app icon.

    icons: Set different size icons for different screen sizes

    theme_color: This color code will change the color of addresser in chrome.

    background_color: Set background color for splash screen.

    name : Full name of the application.

    You can validate your manifest here at https://manifest-validator.appspot.co

    #460632

    Alex Rollin
    Moderator
    Post count: 27815

    We recommend that you use the code snippets plugin to add functions that can be independant of themes so that they will not be overwritten by theme updates.

    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    #461177

    Leonardo Guastella
    Expired Member
    Post count: 164

    So i get a fatal error when trying to add the snippet
    <link rel=”manifest” href=”/manifest.json”>
    Is this all i need to do after creating and uploading the files?
    Im probably doing something wrong here

    #461209

    Alex Rollin
    Moderator
    Post count: 27815

    I’m sorry, we don’t perform customizations here in the forum. If you need help with your custom code you will need to hire a developer. You can find one here:

    https://geodirectoryexperts.com/experts/

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount