Anchor.click() not working on mobiles.

Hi, I have set a stream resource for an anchor and calls to download file like such:

UI.getCurrent().getPage().executeJavaScript("$0.click();", anchor.getElement());

It works fine for browsers, however mobile browsers is not downloading file. Any suggestions?

I have the same issue. Does anybody know the cause and how to use a hidden anchor on mobile?

For me it doesn’t work on iOS with Safari.

As far as I know it’s impossible because it’s a security feature of iOS to disable JavaScript based clicks on links to protect their user.

1 Like

That explains a lot! Thanks for the insights