• Resolved stucorner

    (@stucorner)


    Hi there, I’m testing your WordPress plugin – so first of all – thank you it’s looking like it may be very useful.

    Two problems: 1. When a page hasn’t been found it goes back to the home page (start page) which is correct behaviour. There is one image on that home page which is a link to the course and the link is /itp and so it should, and normally does, go to: /itp, but for some reason, this link is different in the page when it is returned (because the calling page was not cached) – So if I had tried to go to the uncached page /itp/itp6, the link on the image is now /itp/itp6/itp, which is a link that doesn’t exist and so it adds another /itp on the end and now it links to /itp/itp6/itp/itp etc.., etc.. … Sorry, that would’ve been much easier to show you in pictures ??

    2. This is an online course, I would make to sure that a student has got all the assets (all the pages for the course, including audio files) they require before they wander off into the wilderness to sit off and actually do the course. Is there a way of putting a download button which caches the essential assets and makes sure they are good to go without them going to each page, waiting and then testing offline? Is that functionality in the pipeline? A nice progress icon would be cool so they could see how far they have got with downloading.

    Many many thanks for your efforts thus far.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @stucorner

    Thanks so much for the kind words and for trying out SuperPWA!

    The link /itp is set as a relative link instead, like so: <a href="itp/">...</a>. The browser will interpret this as relative to the current URL.

    There are two solutions to this that I can think of. First is to make the URL absolute by replacing /itp with https://stuco.hopto.org/itp/

    Another solution would be to set an offline page (in SuperPWA > Settings) that doesn’t have relative links.

    Is there a way of putting a download button which caches the essential assets and makes sure they are good to go without them going to each page, waiting and then testing offline? Is that functionality in the pipeline? A nice progress icon would be cool so they could see how far they have got with downloading.

    This sounds cool! We have something similar in the making, so I would say yes.

    I am going to add this thread to our internal tracker so that I can look into this idea while working on the specifics.

    Best regards.

    Thread Starter stucorner

    (@stucorner)

    Thanks @arunbasillal – that makes good sense. Thank-you.

    So I went for your second option and set an offline page (in SuperPWA > Settings) that doesn’t have relative links – https://stuco.hopto.org/notcached/. I made a new page telling the user what had happened. It all works well apart from one thing. I put an image on this page but the image seems NOT to get cached if I use a device that hasn’t visited that page whilst it has been online. This would be the case for all devices apart from my development machine, because, of course, the user should never get to that page unless the app is offline.

    I have also changed my ‘Application Short Name’, but that doesn’t seem to be getting updated. I may have a caching problem. I’m using Windows 10 / Chrome to develop on and an Android 6.0 (LG G3) phone / Chrome to test on. I’ve tried clearing Chrome cache and uninstalling and reinstalling the PWA on Android, but the old ‘Wiswo Courses’ ‘Application Short Name’ persists. New short name is ‘Wiswo Pali’.

    Many thanks for your help.

    Hello again @stucorner

    It might have been the cache. I just checked the PWA and the manifest is updated with the new Application Short Name.

    The offline image scenario you mentioned is indeed true. I just tested this and this happens because the image asset is never passed to the Cache.addAll() function, only the HTML is passed.

    I will fix this in the next release of course.

    Until then, a hot fix would be to edit your service worker (in the root folder) and replace const fallbackImage = 'https://stuco.hopto.org/wp-content/uploads/2018/06/Logo_192X192.png'; with const fallbackImage = 'https://stuco.hopto.org/wp-content/uploads/2018/06/Logo_512X512_Stop-150x150.png';

    Thanks for being part of uncovering this.

    Thread Starter stucorner

    (@stucorner)

    That’s great. Thank you @arunbasillal

    Hello @stucorner

    SuperPWA 1.9 takes care of this. When you update from 1.8.1 to 1.9, SuperPWA should be able to detect the images and add them automatically.

    Please let me know if it worked for you. Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Link on ‘Offline Page’ changing link address when page not found in cache’ is closed to new replies.