2

So I did this little experiment PWA caching and service worker which caches entire website (js/css/html) [It's a small website]. Now I do not understand the concept of PWA caching entirely because when I 'Add it to Home screen' it becomes an app as expected but when I turn off the internet and then open the app it requires the internet.

What in fucking ass, why won't you just render those html pages which are cached ?

Comments
  • 1
    @devTea took you 10s to read the entire rant??
  • 2
  • 1
    @devTea so, any two cents about caching, PWA and SW.js
  • 1
    @undef dextel2.surge.sh
  • 2
    @nothappy sorry never used that before
  • 1
    @undef rule 1 of using lighthouse is website should be under SSL protocol so try with https://
  • 1
    @devTea free hosting for static pages
  • 1
    @undef I'm learning Web Notification API, it's code should be in app.js, I haven't minified it yet
  • 0
    @undef Notification Web API, Something like

    var serviceWorkerNotification = function () {

    Notification.requestPermission(function (status) {

    try {

    if (status == "granted") {

    navigator.serviceWorker.getRegistration().then(function (reg) {

    var options = {

    body: "Hello World",

    icon: "favicon/apple-icon.png",

    data: {

    dateOfArrival: Date.now(),

    primaryKey: 1

    },

    actions: [{

    action: 'explore',

    title: 'Explore this new world'

    },

    {

    action: 'close',

    title: 'Close notification',

    },

    ]

    };

    reg.showNotification('Testing Options', options);

    });

    }

    } catch (error) {

    console.error("This is the error", error);

    }

    })

    }

    https://developer.mozilla.org/en-US...
  • 0
    @undef yea, it wouldn't redirect, because free stuff
  • 0
    @undef interesting, but Notification is different from SSL, I'll add this to index.html
  • 0
    @undef I do not follow, I'm learning about Notification Web API right now that's why it is there..I think we've shifted from the entire topic?
  • 0
    @undef yeah, right now it's static, but in future I'm planning to add a panel which pushes notification from user inputs, for that will need to optimize code and make it scalable, So let's say I have to push a notification, I'll add the title, body, image(optional) and other optional things, I think PHP shall help me
  • 1
    Don't know why it didn't work for you. I played around with it and Vue and had no problems whatsoever.
  • 0
    @DawidCyron I've already dropped the project as it's almost finished, don't want to invest more time in it, I've got gulpfile.js problems now, it's minifying js files properly
Add Comment