RE: Button which doesn't open a new window.

Daniel G, modified 6 Years ago. Regular Member Posts: 141 Join Date: 3/14/17 Recent Posts

Hi.

 

I made a portlet which has a button that returns a pdf when it is pressed. The issue is that when the button is pressed, a new window is open, and what I want is opening pdf in the same window.

The button called serveResource function.


Any idea of how can I do this?

 

Thanks in advance.

 

Kind regards

thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Daniel G:
I made a portlet which has a button that returns a pdf when it is pressed. The issue is that when the button is pressed, a new window is open, and what I want is opening pdf in the same window.

The button called serveResource function.

Can you post the code that you used to create this button? It might be simpler to point to a single issue rather than come up with a different solution.
Also, which HTTP-headers do you send back with your PDF?
Note that it might be the browser triggering a new window, rather than your own HTML code.
Daniel G, modified 6 Years ago. Regular Member Posts: 141 Join Date: 3/14/17 Recent Posts

well, first of all, thanks for your help. I came to copy the code of the button and I realised that it has target="_blank", so I deleted it and it works of course. What a mistake!

 

thanks again