I have a function in the HTML side of my .aspx page with the following code:
From the C# side I need to execute this method, but when I put a call in for this method using:
where filePath is my path of the file I want to download...
I keep getting a Javascript Error: "Object Expected"
and the code fails.
Can anyone suggest want is going wrong as I think this should work as the Javascript code runs fine in a standard html page. The problem seems to be when I call the JavaScript method from the C# side.
Regards in advance...
Code:
<script type="text/javascript">
<!--
function downloadNow(file,extUrl)
{
var browser = (window.navigator.userAgent.indexOf("SV1") != -1);
if (browser && extUrl==0)
{
window.open(file, 'DownloadFile', 'width=1,height=1');
window.focus();
}
//-->
</script>
From the C# side I need to execute this method, but when I put a call in for this method using:
Code:
Response.Write(@"<script>downloadnow('"+filePath+@"','0');</script>");
where filePath is my path of the file I want to download...
I keep getting a Javascript Error: "Object Expected"
and the code fails.
Can anyone suggest want is going wrong as I think this should work as the Javascript code runs fine in a standard html page. The problem seems to be when I call the JavaScript method from the C# side.
Regards in advance...