Solved

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

Posted on 2003-12-09
8
531 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery - show / hide div depending on day and time 19 46
Link a VBS to an HTA 6 35
Changing alignment and creating border 6 27
Scroll 5 news at a time. 4 25
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

813 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

18 Experts available now in Live!

Get 1:1 Help Now