Solved

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

Posted on 2003-12-09
8
533 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
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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML Anchor Link Problem 3 52
JavaScript Loan Calculator Error 3 35
email validation 9 49
How do I show a login page over the login page? 5 40
This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

733 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