1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Resolved Disabling Cache

Discussion in 'Other PC Software' started by Dingus, 2021/01/17.

Tags:
  1. 2021/01/17
    Dingus

    Dingus Well-Known Member Thread Starter

    Joined:
    2010/02/03
    Messages:
    109
    Likes Received:
    1
    Hi folks.

    If I explain my issue it'll be easier to understand.
    I placed a Google map in a website. The map was situated on the left of the page. I wanted it in the middle.
    Unfortunately, no matter what code I used, either html or css, I couldn't get it to sit in the centre of the page.

    Every time I changed the code to move it, nothing worked.
    I always do a refresh or F5 when I change anything on a page to see the result.
    Then I accidently discovered that refresh wasn't doing what I thought it should. It was only when I cleared the cache that my code did what I expected it to do.

    Which leads me to my question.
    Does anyone know if it's possible to disable cache while I'm reloading a web page?
     
  2. 2021/01/17
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,368
    Likes Received:
    411
    Sadly, you pretty much told us nothing about your system - starting with, what operating system? What program are you using to create this webpage?

    What cache? There are several different caches, some created by the OS, some by other programs, including browsers, some built into the hardware. For example, there's Temporary File cache, Thumbnail cache, DNS cache, Icon cache, Windows Store cache, Location cache, L1, L2 and L3 CPU caches - to name a few. The Page File (which, BTW, should never be disabled or even dinked with* - regardless how much RAM is installed) is a cache. The buffer built into all drives is a type of cache.

    How did you clear it?

    If you have to keep clearing the cache to make the map stay put, something keeps re-writing the cache.

    *The only real commonly acceptable tweak for Page Files is to move the primary Page File to a secondary drive, if free space is running low on the primary/boot drive. However, this should only be done if the secondary drive is as fast, or faster than the primary boot drive. For example, if your boot drive is a SSD and your secondary is a hard drive, moving the primary Page File to the hard drive will degrade performance, not improve it. Move something else (like installed programs) or buy a bigger boot drive.

    Note I am an electronics technician, not a program developer. I just worked in software development company for many years supporting the hardware used by 400 developers. I have exhausted my knowledge here. Hopefully a programmer/developer will step in with further guidance.
     
    Bill,
    #2

  3. to hide this advert.

  4. 2021/01/17
    Dingus

    Dingus Well-Known Member Thread Starter

    Joined:
    2010/02/03
    Messages:
    109
    Likes Received:
    1
    Hi Bill.
    I'm only assuming it's in a cache.
    To answer your questions.
    I have Windows 10 Pro.
    I've checked this problem in Firefox, Chrome and Internet Explorer. They all behave the same. I'm using the term cache, but I'm now thinking it's something else.
    It's not being held in the RAM as the page is no different after a reboot.
    The only way to clear the previous page is to clear the browser's history.
    The program I use for writting code is Adobe Dreamweaver.

    My OS is on a SDD and my other stuff including servers runs on 4 other drives.
     
  5. 2021/01/17
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,368
    Likes Received:
    411
    Well, you can tell most browsers to clear history upon exiting. Beyond that, if it cannot be fixed with a soldering iron and multimeter, I'm out of my element! ;)
     
    Bill,
    #4
  6. 2021/01/17
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Cache is the correct terminology, specifically, browser cache.

    Place this between <head> and </head> on your page:
    <meta http-equiv="Cache-Control" content="private, no-store" />

    That tells the browser not to cache the page. However, your web host may be caching content too, Siteground hosting does that.

    To get the element centered inside its parent container use css. Example if the map is in a <p>:
    Code:
    <div style ="width: 100%;">
    <p style = "width: 500px; margin: 0 auto;">Hello world.</p>
    </div>
    Note, the <p> must have a set width and it's parent container must be large enough for it to fit.

    Or do:
    Code:
    <div style="text-align: center;"><p>Hello world.</p></div>
     
    Last edited: 2021/01/17
  7. 2021/01/17
    Dingus

    Dingus Well-Known Member Thread Starter

    Joined:
    2010/02/03
    Messages:
    109
    Likes Received:
    1
    Fantastic Tony.
    I have managed to get it to centre by using this in my CSS:
    .gmap_canvas {
    align-content: center;
    margin: 0 auto;
    width: 50%;
    border-style: 5px solid red;
    text-align: center;
    }
    Not had time to check which one did the trick though. I was getting desperate so put everything in. Also no patience.

    Thanks for the cache control. I need this so I don't need to keep clearing the browser history when I'm making site changes. It'll make life easier.
     
  8. 2021/01/18
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    align-content: center; is a bootstrap css style which affects a flex-wrap property, so if not using flex-wrap get rid of it.
    text-align: center; aligns the text or other element within the .gmap_canvas.
    margin: 0 auto; is what positions the .gmap_canvas in middle of the page.
    CSS padding and margin order is Top, Right, Bottom, Left.
    margin: 0 auto; is shorthand for margin: 0 auto 0 auto; (T R B L)
    https://www.w3schools.com/css/css_margin.asp

    Please mark your thread as 'Resolved'.
    When still looking at your thread, near the top of your thread you'll see Thread Tools. Click the down arrow to expand the drop down menu, at the bottom of it you'll see Mark this thread as solved. Click on it to mark your thread as solved.
     
  9. 2021/01/18
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,368
    Likes Received:
    411
    Thanks for stepping in with that, Tony! :)
     
    Bill,
    #8
  10. 2021/01/18
    Dingus

    Dingus Well-Known Member Thread Starter

    Joined:
    2010/02/03
    Messages:
    109
    Likes Received:
    1
    Thanks Tony.
    Wish I was better at this.
    CSS now updated.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.