Empty iframe purpose in Silverlight html test page?

As you may have noticed while creating a Silverlight project, the default html test page generated by Visual Studio 2008 contains the object tag + an empty invisible iframe with no id.

<div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" style="height:100%;width:100%;">
        <param name="source" value="ClientBin/App1.xap"/>
        <param name="onerror" value="onSilverlightError" />
        <param name="background" value="white" />
        <param name="minRuntimeVersion" value="2.0.31005.0" />
        <param name="autoUpgrade" value="true" />
        <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
             <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
    <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>

I have always wondered what is the purpose of this iframe ? 
Got my answer today so I share it:

“The iframe element is for cross-browser compatibility. The presence of the iframe prevents the Safari browser from caching the page. Safari caching prevents the Silverlight plug-in from reloading when the user navigates back to a previously-visited Silverlight page. For more information, see the Safari Developer FAQ.”

Good to know (and stop removing that empty iframe anymore).

No Comments