Skip to content

Custom html in nodebb to prevent cache

Unsolved Configure
18 2 4.2k 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
  • 3 Votes
    1 Posts
    854 Views
    No one has replied
  • Getting Eror When Started NodeBB

    Solved Configure bug
    7
    1
    2 Votes
    7 Posts
    2k Views
    @phenomlab yes i did. i deleted one of plugin then it started to work normally.
  • NodeBB: Upgrading to NodeBB v3.x

    Solved Configure nodebb v3.x
    6
    0 Votes
    6 Posts
    2k Views
    @mventures You’d need to connect to the server and execute it directly - not on your local terminal. Review the guide below, which will show you how to gain access via SSH to your server https://docs.ovh.com/gb/en/dedicated/ssh-introduction/ Once you have access, you’ll need to navigate to the actual folder where NodeBB is installed You’ll then need to change to the directory as shown below /home/unbuntu/nodebb [image: 1680448167972-fdffe673-bf63-4b6d-a728-5506fddc1aff-image.png] In most cases, initial access takes you to the root of the file system. You can always issue pwd in a Linux terminal which will show you the Present Working Directory. From there, you can issue the command cd /home/ubuntu/nodebb Once in the NodeBB directory, you’d use the below commands ./nodebb stop git fetch && git checkout develop && git reset --hard origin/develop ./nodebb upgrade ./nodebb start Line 1 stops the NodeBB instance Line 2 gets the latest files from GIT (repository) and then checks out the development branch. It then resets the version you are using to the development branch ready for v3 Line 3 Runs the upgrade once the new branch is set, and code pulled Line 4 Restarts the NodeBB instance after the upgrade has completed Note that when you restart NodeBB and log back in, things will look very different to what you had in v2.
  • restarting nodebb on boot

    Unsolved Configure nodebb
    3
    1 Votes
    3 Posts
    2k Views
    @eeeee said in restarting nodebb on boot: can I just run nodebb under nodemon for auto restarts? It’s a better method. Nodemon just looks for file system changes and would effectively die if the server was rebooted meaning you’d have to start it again anyway. Systemd is the defacto standard which is how the operating system interacts in terms of services, scheduled tasks etc.
  • Gettin Erors NodeBB

    Solved Configure nodebb eror
    7
    0 Votes
    7 Posts
    2k Views
    @phenomlab no forum is working goods. there is no eror message since yestarday.
  • Recent Cards plugin customization

    Solved Customisation nodebb
    21
    1
    13 Votes
    21 Posts
    10k Views
    @pobojmoks that’s easily done by modifying the code provided here so that it targets background rather than border In essence, the below should work $(document).ready(function() { $(window).on('action:ajaxify.end', function(data) { $('.recent-card-container').each(function(i) { var dataId = $(this).attr("data-cid"); var color = $('[role="presentation"]', this).css("background-color"); console.log("data-cid " + dataId + " is " + color); $('[data-cid="' + dataId + '"] .recent-card').attr("style", "background-color: " + color); }); }); });
  • [NodeBB] username cards

    Solved Customisation nodebb
    8
    5 Votes
    8 Posts
    3k Views
    @phenomlab Aha…nice to know. As always thank you for the reply and information.
  • NodeBB Design help

    Solved Customisation
    8
    3
    2 Votes
    8 Posts
    3k Views
    @riekmedia I’ve applied some new CSS to your site. Can you reload the page and try again ? For the record, this is what I added #footer { background: #2d343e; border-top: 4px solid #2d343e; font-size: 0.9em; margin-top: 70px; padding: 80px 0 0; position: relative; clear: both; bottom: 0; left: 0; right: 0; z-index: 1000; margin-left: -15px; margin-right: -338px; } The /categories page seems a bit messed up, so looking at that currently EDIT - issued some override CSS in the CATEGORIES widget <!--- CSS fix for overspill on /categories page - DO NOT DELETE --> <style> #footer { margin-right: -45px; } </style> That should resolve the /categories issue.