I have an image in which click is bind to open some url in other window. The image is like
<img id="ImgDPreview" src="../images/preview/thumbnail_pdf.jpg" style="border-width:0px;">
What below is a C# code snippet.
string PdfFilePath="\\\\192.23.8.19\\ArvinsPC\\MyFolders\\Original\\69a03d19-4b3d-41bc-9dcf-02982a1468df.pdf";
ImgDPreview.Attributes.Add("onclick", "return PreviewFiles('" + PdfFilePath + "');");
After running this, ImgDPreview
is like
<img id="ImgDPreview" onclick="return PreviewFiles('\\192.23.8.19\ArvinsPC\MyFolders\Original\69a03d19-4b3d-41bc-9dcf-02982a1468df.pdf');" src="../images/preview/thumbnail_pdf.jpg" style="border-width:0px;">
function PreviewFiles(FilePath){
//FilePath here becomes-->'\\192.23.8.19ArvinsPCMyFoldersOriginal69a03d19-4b3d-41bc-9dcf-02982a1468df.pdf'
window.open(FilePath);
}
The issue is on each step a backslash is being vanished from the URL. I know the javascript consider backslash as an escape character. But I need my URL unaltered. Is there any resolution for this.
URL and function names are fictional