开发者

'Access is denied' Javascript error

i am opening a file in IE6.0 from a directory using JavaScript. but iam getting 'Access is denied' error in javascript.My code in javascript

function poponload()
{
testwindow = window.open("C:\Searchtool\asd1.wrl", "mywindow", "location=1,status=1,scrollbars=1,width=300,height=300");
tes开发者_JAVA百科twindow.moveTo(0,0);
}

if i use the same function from plain html page it is opening the page. But if i try to do the samething from ASP.NET2008(.ASPX page), i am getting 'access is denied' error. can anybody tell the reason why it is giving error? and Solution?

Thanks


You are trying to access a file on the hard drive which you aren't allowed to do from a page from a web server.


It's a browser security feature. It won't allow you to directly access the hard drive from a web page. You can access it when you open an HTML file on the local system -- since the browser isn't granting you any more abilities than you already have, but allowing a web page to open a file on a local hard drive would be a huge security flaw.

The only way I know to do things like this are through trusted plugins/applets -- such as ActiveX or Java Applets. These need to be signed and/or have the user explicitly trust them with access to your system to get them to work.


If you are learning html and want a way to open pages in your machine from pages in your machine:

window.open("file:///C:/Searchtool/asd1.wrl", "mywindow", "location=1,
    status=1,scrollbars=1,width=300,height=300");


better, put files in the same directory where is your web page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜