Skip to content

Custom html in nodebb to prevent cache

Unsolved Configure
18 2 2.4k 1
  • I wish to stop browser cash to force nodebb to rerun custom css everytime page is refreshed
    (as it picks different random image as background)
    Theres place for custom css / js
    But where to put this html

    Cache-Control: no-cache
    

    I tried it in a few places but it didnt work

    On further googling do I need all these lines?

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    

    I tried that in Custom Header, didnt work either

  • Strange update with incognito browser it doesnt cache, and shows different background every time.
    But oddly the forum text is different color and looks blurred with icognito

  • I wish to stop browser cash to force nodebb to rerun custom css everytime page is refreshed
    (as it picks different random image as background)
    Theres place for custom css / js
    But where to put this html

    Cache-Control: no-cache
    

    I tried it in a few places but it didnt work

    On further googling do I need all these lines?

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    

    I tried that in Custom Header, didnt work either

    @Panda said in Custom html in nodebb to prevent cache:

    On further googling do I need all these lines?

    Yes, they are all necessary.

  • Strange update with incognito browser it doesnt cache, and shows different background every time.
    But oddly the forum text is different color and looks blurred with icognito

    @Panda said in Custom html in nodebb to prevent cache:

    Strange update with incognito browser it doesnt cache, and shows different background every time.
    But oddly the forum text is different color and looks blurred with icognito

    Incognito is exactly that. It doesn’t cache anything, which is what it’s supposed to do. Are you using a desktop or chrome for this? Also, is your webserver nginx ?

  • @Panda said in Custom html in nodebb to prevent cache:

    Strange update with incognito browser it doesnt cache, and shows different background every time.
    But oddly the forum text is different color and looks blurred with icognito

    Incognito is exactly that. It doesn’t cache anything, which is what it’s supposed to do. Are you using a desktop or chrome for this? Also, is your webserver nginx ?

    @phenomlab so nodebb hosted so Im not using any nginx etc
    Can you tell me if aignite.nodebb.com looks very different for you on mobile chrome, in incognito browser?
    In my incognito, some text barely readable!

    Also still caching on normal mobile browser despite all those lines in custom header

  • @phenomlab so nodebb hosted so Im not using any nginx etc
    Can you tell me if aignite.nodebb.com looks very different for you on mobile chrome, in incognito browser?
    In my incognito, some text barely readable!

    Also still caching on normal mobile browser despite all those lines in custom header

    @Panda if it’s hosted NodeBB then I’m 99% sure that they will be using nginx. Nginx itself will cache static assets - css being one of them, so what you are experiencing is normal behavior, and the cache-control headers you have defined with have virtually zero effect when they are already set by nginx itself.

    On a desktop, you can force the browser to clear that cache for that specific site by pressing f12 to open the developers console, then left click and hold on the reload button in the browser

    After and one second you’ll see three options. You want the third, which is “Clear cache and reload”

    I know you use your phone to do most things, but I can tell you now that it’s almost impossible to develop in this way and it needs to be done via a PC or laptop.

  • @phenomlab so nodebb hosted so Im not using any nginx etc
    Can you tell me if aignite.nodebb.com looks very different for you on mobile chrome, in incognito browser?
    In my incognito, some text barely readable!

    Also still caching on normal mobile browser despite all those lines in custom header

    @Panda said in Custom html in nodebb to prevent cache:

    Can you tell me if aignite.nodebb.com looks very different for you on mobile chrome, in incognito browser?

    What I can tell you is that the white overlay with the lime green text doesn’t work. It’s virtually illegible and not pleasing to the eye at all.

  • @Panda said in Custom html in nodebb to prevent cache:

    Can you tell me if aignite.nodebb.com looks very different for you on mobile chrome, in incognito browser?

    What I can tell you is that the white overlay with the lime green text doesn’t work. It’s virtually illegible and not pleasing to the eye at all.

    @phenomlab yes, but the point about browser cache on mobile, I want the users to get a different background pic each time.

    So I know I an manually clear cache, but the users shouldnt need to know about that.

  • @phenomlab yes, but the point about browser cache on mobile, I want the users to get a different background pic each time.

    So I know I an manually clear cache, but the users shouldnt need to know about that.

    @Panda how are you issuing the image? If you use JS to do this, you won’t need to worry about browser cache. It’s a little unclear as to what you currently have in place.

  • @Panda how are you issuing the image? If you use JS to do this, you won’t need to worry about browser cache. It’s a little unclear as to what you currently have in place.

    @phenomlab
    Just css with a random image url
    You have login, take a look?

  • @phenomlab
    Just css with a random image url
    You have login, take a look?

    @Panda I’m not in front of a PC presently, but can look tomorrow.

  • @Panda I’m not in front of a PC presently, but can look tomorrow.

    @phenomlab the forum looking so different on incognito and standard browser is so weird.
    (This is on Android device)
    Its like the Neon theme is much more Neon on the incognito, and the text is hard to read!

  • @phenomlab the forum looking so different on incognito and standard browser is so weird.
    (This is on Android device)
    Its like the Neon theme is much more Neon on the incognito, and the text is hard to read!

    @Panda said in Custom html in nodebb to prevent cache:

    Its like the Neon theme is much more Neon on the incognito, and the text is hard to read!

    Incognito mode will always reflect the current state of affairs as it will not cache anything. If it looks bad in this session, this is how others will see it also.

  • @Panda What I see on checking the site is this

    image.png

    It looks psychedelic and the colours do not work at all.

  • @Panda What I see on checking the site is this

    image.png

    It looks psychedelic and the colours do not work at all.

    @phenomlab yes, but skins / themes arent supposed to cache.
    So my main issue here is why was it looking different?
    I’ve changed skin now, but still want to get round this caching, as still have problem on normal broswer that I dont get new background image every time browser bar refreshed

  • @phenomlab yes, but skins / themes arent supposed to cache.
    So my main issue here is why was it looking different?
    I’ve changed skin now, but still want to get round this caching, as still have problem on normal broswer that I dont get new background image every time browser bar refreshed

    @Panda said in Custom html in nodebb to prevent cache:

    yes, but skins / themes arent supposed to cache.

    They will cache by default - by NGINX, and not anything you choose to put in the headers. The code you specified there would apply to the entire site, which defeats the purpose of using a cache to speed up delivery of assets that the browser already has. Even without the case in Incognito mode, the experience is awful because most of the text is unreadable.

    The point you made about fonts looking blurry is because of the presence of text-shadow as a CSS element. This technique is used to made text stand out by using a drop shadow of another colour. This now clashes with the changes you have made and makes the text look blurry.

  • So if I cant prevent cache, how do I achieve different background each time?

  • So if I cant prevent cache, how do I achieve different background each time?

    @Panda You’ll need to do that with js. With some quick CSS changes, it looks like this

    d619844f-fbfe-4cf1-a283-6b7364f6bf18-image.png

    The colour choice is still really hard on the eye, but at least you can now read the text


Related Topics
  • Page control arrows for PWA

    Solved Customisation nodebb
    27
    25 Votes
    27 Posts
    7k Views
    @crazycells it is, yes - I think I’ll leave it as there is no specific PWA CSS classes I know of. Well, you could use something like the below, but this means multiple CSS files for different operating systems. /** * Determine the mobile operating system. * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'. * * @returns {String} */ function getMobileOperatingSystem() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; // Windows Phone must come first because its UA also contains "Android" if (/windows phone/i.test(userAgent)) { return "Windows Phone"; } if (/android/i.test(userAgent)) { return "Android"; } if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { return "iOS"; } return "unknown"; // return “Android” - one should either handle the unknown or fallback to a specific platform, let’s say Android } Once you’re in that rabbit hole, it’s impossible to get out of it.
  • Composer options on nodebb

    Solved Configure nodebb
    8
    1
    3 Votes
    8 Posts
    1k Views
    @Panda You should be able to expose the CSS for these using F12 to get into console [image: 1686833368846-3591518c-e3a3-4ada-a43c-6b32a5e0359c-image.png] [image: 1686833399483-a2b8ed46-4157-4ff2-85f0-576543380107-image.png] That should then expose the element once selected [image: 1686833431032-89d9c545-a47a-40d1-98f4-80cf3b958e8f-image.png] Here’s the below CSS you need based on the screenshot provided. .composer .formatting-bar .formatting-group li[data-format="picture-o"], .composer .formatting-bar .formatting-group li[data-format="spoiler"] { display: none; }
  • MailGun Not Working NodeBB

    Solved Configure mail mailgun
    6
    1 Votes
    6 Posts
    934 Views
    @phenomlab did it i did not create smtp user on mailgun. everything is working now. [image: 1667569376261-6cc6061f-ed5d-41f6-8eb7-5d98f98b3706-image.png]
  • Configure SMTP for Nodebb

    Solved Configure
    14
    5 Votes
    14 Posts
    2k Views
    @marusaky based on the work completed thus far (in relation to PM exchanges), I’m going to mark this completed. Sending email from the server itself works fine without issue, and DNS appears to be clean (valid SPF, DMARC, and DKIM records). It appears that only Gmail marks incoming messages from your domain as spam - perhaps because of the domain age, which there is nothing we can do to prevent this. Mail delivery to all other domains appears to work fine in al of my tests.
  • background color of the footer area

    Solved Customisation nodebb
    7
    1
    7 Votes
    7 Posts
    1k Views
    @phenomlab thank you very much
  • NodeBB metadata

    Solved Configure nodebb
    4
    2 Votes
    4 Posts
    960 Views
    @phenomlab said in NodeBB metadata: @jac Are you sure ? https://www.google.co.uk/search?q=site%3Astockportcounty.fans&sxsrf=AOaemvLwnaZL-PliU_2dBOg_Eo1pMVhBjg%3A1638982328139&source=hp&ei=uOKwYeatBcOsad3yp7AE&iflsig=ALs-wAMAAAAAYbDwyLBSDcG5XYoFCKwQFhgz94wTxOcV&ved=0ahUKEwjm6dX71NT0AhVDVhoKHV35CUYQ4dUDCAk&uact=5&oq=site%3Astockportcounty.fans&gs_lcp=Cgdnd3Mtd2l6EAM6BAgjECc6CwgAEIAEELEDEIMBOg4ILhCABBCxAxDHARCjAjoRCC4QgAQQsQMQgwEQxwEQowI6BQguEIAEOggIABCABBCxAzoFCAAQgAQ6CAguELEDEIMBOgsILhCABBDHARCvAToICC4QgAQQsQM6BQgAELEDOgsILhCABBDHARDRAzoLCAAQgAQQsQMQyQM6BQgAEJIDUABYySZg0CdoAHAAeACAAW2IAa0NkgEEMjMuMpgBAKABAQ&sclient=gws-wiz Fair enough 🤪🤪.
  • nodebb dropdown menu

    Solved Configure nodebb
    5
    1
    0 Votes
    5 Posts
    1k Views
    @phenomlab said in nodebb dropdown menu: @kurulumu-net You set it like the below example taken from this site [image: 1637939951821-aae36790-3257-4bb2-ad5a-0d744309876a-image.png] Which presents this [image: 1637939983445-77f47260-2941-4afe-9614-8e17dcfc8c19-image.png] Very interesting… I actually thought this wasn’t possible, as I remember it being asked in the NodeBB forum. Is this something new that’s been implemented? I’ll 100% be doing that when I’m on the laptop over the weekend.
  • [NodeBB] custom Gravatar image not showing

    Solved Customisation
    6
    1 Votes
    6 Posts
    2k Views
    @jac said in [NodeBB] custom Gravatar image not showing: @phenomlab said in [NodeBB] custom Gravatar image not showing: @jac are you using Custom ? Sure am mate Confirmed Fixed