Solved

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

Posted on 2003-12-09
8
528 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now