function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NareshNaresh 

Open File from UNC path

Hi,
     can anyone give me the solution defined below:

I created an s-control that execute on any page loading.
There is one button say 'View' on html s-control.
I want to open a file that is located on local machine by clicking the 'View' button in salesforce.

But it gives some Security error.

Can anyone tell how can i resolve this problem?

Thanks in advance
WarrenWarren
Can you post the HTML?
NareshNaresh

Hi,
         The following is the html s-control that i executed on 'View' button clicking.


<html><head><title>New Link</title>
</head>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/8.0/connection.js"></script>
<script language='javascript'>
var linkId = '{!Link__c.Id}';
var fileName = '{!Link__c.Name}';
var filePath = '{!Link__c.File_Path__c}';

function openFile()
{
//window.open("c:/Documents and Settings/Naresh/Desktop/DisableMcfeeMail.txt");
//    window.open("file:///c:\Documents and Settings\Naresh\Desktop\DisableMcfeeMail.txt");

window.location= filePath;
}

</script>
<body>

<table class="" border="0" cellpadding="0" cellspacing="0">
<tr  align='center'><td><input value=" View File" class="btn" id='Viewbtn' title="View" name="View" onclick="openFile()" type="button" ></td>
</tr>
</table>

</body></html>




When i click on the view buttton it give the following error message in the javascript error console:

Security Error: Content at https://na3.salesforce.com/servlet/servlet.Integration?lid=01N500000000eZj&eid=a0150000009FnHt&ic=1&autoMapValues=1 may not load or link to file:///C:/Documents%20and%20Settings/Naresh/Desktop/DisableMcfeeMail.txt.


Error: Access to 'file:///C:/Documents%20and%20Settings/Naresh/Desktop/DisableMcfeeMail.txt' from script denied
Source File: https://na3.salesforce.com/servlet/servlet.Integration?lid=01N500000000eZj&eid=a0150000009FnHt&ic=1&autoMapValues=1
Line: 50

can u plz help me out to resolve the problem

Thanks in advance

Message Edited by Naresh on 05-16-2007 11:33 PM

WarrenWarren
Generally you cannot open non secure content from a secure site using script.
 
A workaround for this problem is not to use script but to use a hyperlink to the file that opens the file in a blank window. Such as this:
 
<a href="{!Link__c.File_Path__c}" target="_blank">Button</a>
 
Replace "Button" with an image if you like.
 
You may still get a security warning, depending on your settings, but if you click OK or yes, the link should still open.
 
Warren
NareshNaresh
Hi,
        i have already tested with following options:

window.open("file:///c:/test.txt");
window.open("file://c:/test.txt");

window.location="file:///c:/test.txt";
window.location="file://c:/test.txt";

<a href="file:///c:/test.txt" target="_blank">Button</a>
<a href="file://c:/test.txt" target="">Button</a>
<a href="{!Link__c.File_Path__c}" target="_blank">Button</a>

but still its not working.

thanks

Raman OberoiRaman Oberoi
Hi Naresh, did you got a solution to this problem; i am also trying to do something similar
ParallaxViewParallaxView

I'm trying to put an UNC path in a KB article in Salesforce for our employees.  I'm not trying to use Java or anything, I'm just trying to add a URL starting with file///// but Salesforce always adds http://file/////      Has anyone found a way to get around this.  This is really annoying.

cruttley2cruttley2
I have the same requirement,. Just wondering if anyone ever figured out how to do this?