Solved

My image in an IFRAME:d document doesn't reload

Posted on 2003-12-09
8
534 Views
Last Modified: 2008-02-01
I have a window that contains an iframe tag. The document in the iframe tag is an aspx file that displays a map, and navigation arrows (north, south, west, east). When I press an arrow, a sub in my aspx file executes on the server, retrieving the new map, and places it in a session variable. That variable is read by the image file (also an aspx) and is written with the response object to the client.

When I run the iframe:d document in a separate window, it works fine, but when the document is in the iframe, the image doesn't reload, and thus doesn't display the new map. Please help me and explain why.

I have used Response.Cache.SetCacheability(HttpCacheability.NoCache) in the map.aspx as well as the iframed aspx document. In the surrounding document, I have used Response.CacheControl = "Private" and Response.Expires = 0.

- Niklas
0
Comment
Question by:nringdahl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 7

Expert Comment

by:gam3r_3xtr3m3
ID: 9903588
well, i can't think of any solution. but try to empty your cache then try the script again.
0
 
LVL 1

Author Comment

by:nringdahl
ID: 9903617
Empty how? I have already set the cache to "do not cache" (see original question). Or am I missing something?

- Niklas
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9904814
show us the browser code as well.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:nringdahl
ID: 9905152
Ok, I can't send you all the code, but here are some parts. Please let me know if there are specific parts that you would like to see.

- Niklas

details.asp:
...
<%      Response.CacheControl = "Private"
      Response.Expires = 0
%>
...
      <script language="javascript">
      
      function showMap() {
      
            window.resizeTo(650, 800);
            document.all("frameKarta").src = "<%=mapLink%>";
            document.all("frameKarta").height="400";
            document.all("frameKarta").width="500";
            
      }
      
      </script>

...
<iframe id="frameKarta" src="" frameborder="0" marginheight="0" marginwidth="0" height=0 width=0 scrolling=no></iframe>
...
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9924766
Do not use document.all.

1. MSIE only.

2. Even MSDN says it's deprecated and should no longer be used.

Use <iframe name="frameKarta" width="500" height="400">(Your browser doesn't support inline frames.)</iframe
<input type="button" value="Show Map" onclick="showMap();">
<script type="text/javascript">
function showMap()
{
  window.resizeTo(650, 800);  //  not good -- what does this to for people using 800x600 resolution?
  window.frames["frameKarta"].src = "<%=mapLink%>";
}
</script>
0
 
LVL 1

Accepted Solution

by:
nringdahl earned 0 total points
ID: 9950637
Hello.

Zontar: window.frames doesn't work.

I have solved the problem myself. Apparently, despite my efforts to prevent caching, the image was somehow cached. When I opened the image file in a separate window, the updates went smoothly. So I added a random number to the url of the map image, and it fooled the web server enough to reload my image every time.

Thanks for everybodys effort, but I can't give my points to either of you. Wonder if I can give it to myself?

- Niklas
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question