Results 1 to 4 of 4

Thread: DHTML Window Caching problem

  1. #1
    Join Date
    Jun 2005
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question DHTML Window Caching problem

    http://www.dynamicdrive.com/dynamici...htmlwindow.htm
    dhtml window

    Hi,

    I'm having a bit of an issue with the DHTML window routine. I am using the DHTML window to display a local page when the user selects a link on the main page. If I change the page being displayed in the iframe, the page displayed in the DHTML window does not change. The only way I can update it is to load the iframe src page in a regular window and refresh it. Then, when I show the page in the DHTML window, it will show the updated page.

    Is there any way to initialize the script so that when the user selects refresh, the cache is cleared of the old page so the new version is loaded?

    Thanks,

    Thomas

  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

    I'm not very clear on what you are saying. I had a demo of this script set up already. I removed this part:
    Code:
    <script>
    //Use below code to load DHTML Window as page loads 
    if (ns6) window.onload=new Function('loadwindow("http://www.google.com",600,400)')
    else
    loadwindow("http://www.google.com",600,400)
    </script>
    Then I added to the existing link that comes with the script so that I had these two links:
    HTML Code:
    <a href="javascript:loadwindow('http://www.google.com',600,400)">Geocities</a><br>
    <a href="javascript:loadwindow('http://www.yahoo.com',600,400)">Yahoo</a>
    Now, when the page loads, also when it is refreshed, there is no pop-up visible. If I click on either link, I get the pop-up with the appropriate page in it. If I click on the other link, while the first is visible, the second replaces it, if I close the pop-up, it goes away. If I refresh, the pop-up goes away. Anyways, what do you expect to have happen?
    - John
    ________________________

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

  3. #3
    Join Date
    Jun 2005
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was talking about publishing changes to the website.

    Let's say I have a DHTML window in index.html pointing to say About.html.

    In a browser I am showing http://www.mysite.com/index.html

    I make a change to About.html and publish it to the site.

    When I refresh index.html, it still shows the old version of About.html in the DHTML window. In order to refresh the DHTML window, I have to open http://www.mysite.com/About.html, then, when I go back to index.html it shows the new About.html in the DHTML window.

    So far it's not such a bad problem, I guess I'm just worried about showing dynamically changing pages in DHTML windows, perhaps it won't update appropriately in certain situations.

    Thomas

  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

    I was playing around with this DHTML window script some more and have decided it isn't one of my top picks for reliability. The biggest problem is that the drag and drop feature in IE is shaky and no amount of tweaking I have come up with so far makes it 100%. I see you have disabled the drag and drop feature in your implementation - good idea. Another thing I discovered was that using this syntax to launch content in the iframe:
    HTML Code:
    <a href="javascript:loadwindow('Win_About.htm',550,760)">About</a>
    isn't the best way to go about it. It causes some minor problems in Mozilla and will cause an error if javascript is disabled. A better approach is:
    HTML Code:
    <a href="Win_About.htm" onclick="loadwindow(this.href,550,760);return false;">About</a>
    That way, non javascript enabled browsers will be taken to the page itself and Mozilla won't be tempted to endlessly spin its little 'loading . . . ' symbol.

    As far as pages getting cached. Generally that happens when the page is in your history and you are accessing it via the same link from the same page you did last time. Some servers are better at avoiding this than others. Your browser can be configured to always check for updated content. You can clear your cache frequently or set it to clear each time the browser is closed. There are also meta tags that can be placed on a page to prevent it from being loaded without checking to see if it has been updated:
    HTML Code:
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT">
        <meta http-equiv="Cache-control" content="no-cache">
        <meta http-equiv="Cache-control" content="must-revalidate">
        <meta http-equiv="Cache-control" content="max-age=0">
    These go in the head of the document. They are no guarantee but, work in most cases.
    - John
    ________________________

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

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
  •