Tuesday, March 25, 2008

IE caches IFrame pages. Page load does not fire in IFrame page.

I had this issue on a project that I was working on. I created an IFrame to load a page in a modal window. On the close of the modal window I will close the frame, and then when the user clicks on a button to open the window I will recreate the frame with the same url to load the page. This worked fine with FireFox. On every load of the modal window I the Page_Load event will fire, however, with IE this was not the case. I solve the problem by creating a unique request every time setting a parameter with a random number in the source of the IFrame.

Iframe.src="MyPage.aspx?unique="+ Math.random();

No comments:

Post a Comment