Open PDF in New Window from Code Behind using JavaScript
-
Hello All, I want to open PDF file in new window on button click event from code behind through JavaSctipt. I am using below mentioned code for opening PDF file in new window.
string PopUpWindowPage = @"E:\\\Prism4.pdf";
string Script = "";
Script += "<script id='PopupWindow'>";
Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + 1 + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";
Script += "</script>";
if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
Page.RegisterClientScriptBlock("PopupWindow", Script);I get below mentioned error message while opening the PDF file in new window.
Microsoft JScript runtime error: Access is denied.
Can Anyone tell me whats the issue with above code or any other settings have to do? Thanks in Adv...
-
Hello All, I want to open PDF file in new window on button click event from code behind through JavaSctipt. I am using below mentioned code for opening PDF file in new window.
string PopUpWindowPage = @"E:\\\Prism4.pdf";
string Script = "";
Script += "<script id='PopupWindow'>";
Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + 1 + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";
Script += "</script>";
if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
Page.RegisterClientScriptBlock("PopupWindow", Script);I get below mentioned error message while opening the PDF file in new window.
Microsoft JScript runtime error: Access is denied.
Can Anyone tell me whats the issue with above code or any other settings have to do? Thanks in Adv...
- Check the file path is correct and accessible using normal window.open() method 2) try not using depricated method. There are general reasons for this error
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
-
Hello All, I want to open PDF file in new window on button click event from code behind through JavaSctipt. I am using below mentioned code for opening PDF file in new window.
string PopUpWindowPage = @"E:\\\Prism4.pdf";
string Script = "";
Script += "<script id='PopupWindow'>";
Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + 1 + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";
Script += "</script>";
if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
Page.RegisterClientScriptBlock("PopupWindow", Script);I get below mentioned error message while opening the PDF file in new window.
Microsoft JScript runtime error: Access is denied.
Can Anyone tell me whats the issue with above code or any other settings have to do? Thanks in Adv...
You need a client script manager first. cs = clientscript manager
Dim cs As ClientScriptManager = Me.Page.ClientScript
Dim rsType As Type = Me.GetType()If (Not cs.IsClientScriptIncludeRegistered(rsType, "jquery")) Then
cs.RegisterClientScriptInclude("jquery", cs.GetWebResourceUrl(rsType, "SC_Standard.jquery.js"))
End If