Prevent your Silverlight XAP File from Caching in your Browser

话不多说,

为什么要这么做?

1.上篇文章提到过 sharepoint silverlight webpart 加载时间过长第一次回抛出异常

2.silverlight会缓存xap包,如不清理页面的缓存,最新的xap包不会执行

参考文档

1.Prevent your Silverlight XAP File from Caching in your Browser

2.How to: Add Silverlight to a Web Page by Using JavaScript

< div id = " silverlightControlHost "  style = " padding-left: 325px " >
    
< script type = " text/javascript "  src = " /_layouts/Silverlight.js " ></ script >
    
< script type = " text/javascript " >
        var d 
=   new  Date();
        var tick 
=  d.getFullYear().toString()  +  d.getMonth().toString()  +  d.getDate().toString()  +  d.getHours().toString()  +  d.getMinutes().toString()  +  d.getSeconds().toString()  +  d.getMilliseconds().toString()  +   "" ;
        Silverlight.createObject(
                    
" /sites/cmgresearch/Pages/ExportListsToExcel.xap? "   +  tick,
                    silverlightControlHost,
                     
" slPlugin2 " ,
                    { width: 
" 150 " , height:  " 20 " , background:  " white " , initParams:  " MS.SP.url=http://sharepoint/sites/cmgresearch/ "  },
                    {},
                    
" id=slPlugin2,embeddingTechnique=createObject " );
    
</ script >
</ div >

 

你可能感兴趣的:(silverlight)