0

I have a link to open, on click of which a pdf file opens. The code for the same is as displayed below and works fine.

 function OpenPdfPopup(ImageUrl) {
            var winWidth;
            var winHeight;
            winWidth = screen.width;
            winHeight = screen.height;
            var urlpath = ImageUrl + ""
            OpenWindow(urlpath, 'invImageWin', winWidth, winHeight, 'no')

        }
        var viewIMGDocQueue = function (link) {

            var imgName = link.attr("data-imagename"),
            ImageDirectory = link.attr("data-ImageDirectory"),
            companyId = link.attr("data-companyid"),
            winWidth,
            winHeight,
            imageId = link.attr('data-imageid'); // IAMGE ID IS NEEDED TO BE PASSED IN NEW WEBSITE AND THE PAGE LINK IS CHANED TOO.

            imageId = imageId != undefined ? imageId : 0;
            winWidth = screen.width;
            winHeight = screen.height;
            var urlpath = "../workflow/PdfDisplay.aspx?ImageId=" + imageId + "&file=" + imgName;
            OpenWindow(urlpath, 'invImageWin', winWidth, winHeight, 'no');
        };

But the problem occurs when the pdf file name has % sign in it. Please suggest solution for it. Note: The file name cannot escape the % character and hence it cannot be replaced in javascript.

user2783853
  • 137
  • 1
  • 13
  • I was wondering why don't you use replaceAll, perhaps not the best solution but at least could remove % character. Here's a link might be helpful: [replaceAll](http://stackoverflow.com/questions/1144783/replacing-all-occurrences-of-a-string-in-javascript) – Ali Feb 09 '15 at 09:55
  • The imgName variable has value from database from which I cannot replace since it is the need to be kept as it is – user2783853 Feb 09 '15 at 10:02

0 Answers0