Open link when button click

Open link when button click

  

I have an issue when trying to show pdf:

- there are 2 urls to print pdf

- when i click a button, i want to open those two pdfs

Unfortunately, only the last one is shown in the pdf viewer.

How to show both?

Thank you,

regards,

A

Hi Anonymous,

What PDF viewer are you talking about? And for that matter, what URLs and what button? Is this an application you created? Something else?

Thank you Sir,

Those are pdfs created using jasper report.When i clicked a button(button A) then the button also clicked -using widget_click- another button (button B) that refer to external URL. It is okay when there is one pdf, the pdf viewer /reader shows up.

Unfortunately, when there are two hidden button clicks  (button B clicked twice using widget_click) that contain different URLs(pdf document), only one pdf reader instance is generated and it shows only the last pdf document.

How to make it showing those pdfs into two pdf reader instances? Tq

Regards,

A


Hi Anonymous,

Make sure you Ajax refresh the hidden link/button after changing the variable that contains the URL. URLs are set in the preperation and don't change, unless you Ajax refresh them.

i did this Ajax Refresh, but still the same result. I am trying to open a new window tab for every click using extended properties "target=_blank" on the hidden button, but does not work as well - only one tab is open.  

regards,

A

Solution

Hi Anonymous.

I am not sure if that's possible at all. Browsers are very restrictive on when and how you can open a new tab in javascript. For instance, I don't think that you can open a new tab with a Widget_Click at all, because the browser detects as an action not initiated by the user (it was initiated by the server). So I'm surprised that you say that you could open one tab!


I think it's very unlikely that a browser would let you open two tabs triggered by a single click. That would open a pandora box for advertisers.


Having said that, please consider another design, maybe not using popups at all. For example, you could just use two columns on your page to display both contents side-by-side (if that's what you are trying to achieve). Or, at least, have two buttons, one for each tab.

EDIT: I have found this stackoverflow thread: https://stackoverflow.com/questions/7064998/how-to-make-a-link-open-multiple-pages-when-clicked

It does provide a solution (try it here) that works in Firefox, but gets blocked by Chrome. Not sure about IE/Edge/Safari.

Solution

Leonardo Fernandes wrote:

Hi Anonymous.

I am not sure if that's possible at all. Browsers are very restrictive on when and how you can open a new tab in javascript. For instance, I don't think that you can open a new tab with a Widget_Click at all, because the browser detects as an action not initiated by the user (it was initiated by the server). So I'm surprised that you say that you could open one tab!


I think it's very unlikely that a browser would let you open two tabs triggered by a single click. That would open a pandora box for advertisers.


Having said that, please consider another design, maybe not using popups at all. For example, you could just use two columns on your page to display both contents side-by-side (if that's what you are trying to achieve). Or, at least, have two buttons, one for each tab.

EDIT: I have found this stackoverflow thread: https://stackoverflow.com/questions/7064998/how-to-make-a-link-open-multiple-pages-when-clicked

It does provide a solution (try it here) that works in Firefox, but gets blocked by Chrome. Not sure about IE/Edge/Safari.


Thank you Sir,

You are correct that the browser do not let the server action to open a new tab - it is is the already existing tab, not a new one.

In the case of pdf url it is opened in the pdf reader instance (not in a browser).. so the solution is as you proposed - create all in single pdf.


Regards,

A