user2625279
user2625279

Reputation: 67

Window.open() not working in liferay portlet

i want to open a pdf file from a liferay portlet. i tried using window.open() but its not working out for me. the pdf file is residing in c:\MyFolder

<tr>
    <td>
        <a href="" onclick="javascipt:window.open('C:\\MyFolder\\a.pdf');" class="popup">Click to open.</a>
    </td>
</tr>

On clicking the link the page redirects to http://localhost:8080/web/guest/. Would really appreciate someone's help.

Upvotes: 0

Views: 477

Answers (1)

Niranjan
Niranjan

Reputation: 1834

In order to open a PDF in a new Window the url should point to any of the following

  1. PDF file residing on Server
  2. Any URL where Server is capable of streaming a PDF
  3. ResourceURL where your Portlet's serveResource streams a PDF

Upvotes: 1

Related Questions