开发者

window.open("c:\test.txt") from Silverlight

I'm trying to open local file from Silverlight. I try Window.Navigate("c:\test.pdf", "_blank") and invoking JavaScript like this:

window.open("c:\test.pdf", "_blank")

Both give "Access is denied".

However it works in plain HTML when I do

<input type="button" value="test" 
       onclick="window.open('c:\test.pdf', '开发者_运维技巧_blank')" />

Is it Silverlight security restriction? Can I open a local file in a browser from Silverlight application?

The reason behind this is that users store local paths and want to open those files from the app.


Silverlight is heavily sandboxed. As it is a web technology, you can probably imagine the potential security implications of giving it access to the file system.


In Silverlight 4, you have access in the local file system, but to the user's "My" folders only. See http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#localfiles

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜