Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Clear Cache Script

  1. #1
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Clear Cache Script

    I decided to post this as a new thread.

    I'm reloading a page with an animated gif. When NS reloads the page it takes the graphic from cache -- no animation. Is there a script to clear the NS cache? The problem doesn't seem to exist in IE.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Are you sure that is what is happening? An animated .gif is an image, and if cached, will still be animated whether retrieved from the cache or from the web. If the problem is that regardless of what I've just stated, it still acts like what you are saying and there is no other cause at work, this may help (requires a transparent .gif):

    HTML Code:
    <img src="transparent.gif" onload="if(this.src.indexOf('my_animated.gif')==-1)this.src='my_animated.gif'">
    PLEASE: Include the URL to your problematic webpage that you want help with.

    How are you reloading the page?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Hi John.

    The graphic is a transparent gif. It works fine in IE, but not in NS. If I manually clear the cache in NS before the reload, then it works. But only the next time. Then nothing.

    The code's not on a server -- yet. So I can't let you look at it. But here's the "reload" code:

    <script type="text/javascript">
    <!-- Begin
    function reFresh() {
    window.location="Logo.html"
    }
    /* Set the number below to the amount of delay, in milliseconds,
    you want between page reloads: 1 minute = 60000 milliseconds. */
    window.setInterval("Doit()",15000);
    // End -->
    </script>

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Jim Weinberg
    Code:
    <script type="text/javascript">
    <!-- Begin
    function reFresh() {
    window.location="Logo.html"
    }
    /* Set the number below to the amount of delay, in milliseconds,
    you want between page reloads: 1 minute = 60000 milliseconds. */
    window.setInterval("Doit()",15000);
    // End -->
    </script>
    That won't do anything as Doit() is not defined.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Sorry. Didn't drag the cursor down far enough.

    <script>

    function Doit(){
    parent.Logo.location='Logo.html';
    </script>

    Logo.html contains the animated gif.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You haven't closed the function block.
    Quote Originally Posted by John
    Code:
    <img src="transparent.gif" onload="if(this.src.indexOf('my_animated.gif')==-1)this.src='my_animated.gif'">
    Urgh, nasty. I do not recommend this, due to the fact that non-JS browsers won't be able to see the image.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    You haven't closed the function block.
    Urgh, nasty. I do not recommend this, due to the fact that non-JS browsers won't be able to see the image.
    I didn't open one either. It works, trust me. Good point on non-JS browsers though. It was just something to try if there truly were a problem with the cache, which I don't think there is. After going over most (if not all) of the OP's posts though, I think it is just that his code is slipshod.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Twey. Thanks for your input. I don't want to take a chance on it not working for non-js browsers.

    BTW, its nice to see that not everyone has to make negative comments in order to show how "knowlegable" they are. I'm only 12 and am just starting out with JS. I was about to give up asking questions on this forum until I read your reply.

    Thanks again.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Jim Weinberg
    BTW, its nice to see that not everyone has to make negative comments in order to show how "knowlegable" they are. I'm only 12 and am just starting out with JS. I was about to give up asking questions on this forum until I read your (Twey's) reply.

    Thanks again.
    I knew we were keeping Twey around for a reason. Jim, don't feel bad. There is plenty I do not know. It just gets frustrating when the code I need to see in order to help is not there. Also, it can reach a point where I don't know if what someone is posting is what they have or just a poor copy of it. In any case, regardless of my tone or how you feel about it, code must be written properly (for the most part) to work. There are exceptions in certain browsers and quirks of other browsers that should be respected if you want your code to work in them. But, as I say, don't give up. At least you are trying.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by John
    Quote Originally Posted by myself
    You didn't close the function block.
    I didn't open one either.
    I was referring to the OP's DoIt() function.
    I knew we were keeping Twey around for a reason.
    It's evidently my amazing people skills. Maybe I should become a banker.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •