Open Folder on IE using javascript (CRM 4.0)?
I wan开发者_开发知识库t to see my specific folder on IE window.i use window.open(); and then i get an error "Access denied".I gave "everyone" permission on this folder and share it.
var oShell = new ActiveXObject("Scripting.FileSystemObject");
var Path="C:\\test\\"+crmForm.ObjectId;
if (! oShell.FolderExists(Path) )
{
oShell.CreateFolder(Path)
}
crmForm.all.new_paylasim.DataValue=Path;
var urlField =crmForm.all.new_paylasim;
urlField.style.color = 0x0000ff;
urlField.style.textDecorationUnderline = true;
urlField.style.cursor = "hand";
urlField.ondblclick = function() {
var url = urlField.DataValue; // Or get it from somewhere else
if (url != null && url.length > 0) {
window.open(url);
}
}
What's solution?
You have to problems
- the security model of IE has changed and window.open with a local file path does IMHO not work anymore. See also Ie 8.0 Access Denied When Trying To Open Local Files
- Your file uri is not correct. It should be either
file:///C:/myfile.txt
(which doesn't work anymore) orfile://server/share
for a network share. See http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
Create a network share for the folder you would like to open.
精彩评论