Application unresponsive after mailto: link in application/pdf is opened

asked 2022-04-21 13:12:01 +0800

sjm gravatar image sjm

The version of zk in the application is 7.0.8. I have a pdf file opened with a pdf viewer inside application, while clicking the link and opening it using the mail app makes the application unresponsive, need to refresh the application to continue. I have tried the work-around suggested in ZK-3646 but it's of no use.


delete flag offensive retag edit


We have given you more karma so that you can post related fiddle links or sample code. Please provide a reproducing code snippet.

jeanher ( 2022-04-25 15:54:37 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2022-04-25 18:15:59 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

I think you might encounter file download link problem, please read https://www.zkoss.org/wiki/ZKComponentReference/EssentialComponents/A#FileDownload_Link to create a download link in the right way.

link publish delete flag offensive edit


Thank you Hawk, your suggestion works when we have mailto: link in the web page. Is there any way to make the same thing to happen if we are opening mailto: link from a pdf opened inside zk application?

The pdf is opened inside zkpplication using HttpServletResponse

sjm ( 2022-05-19 12:15:40 +0800 )edit

could you provide a reproducible case? or show us related code? do you use zk <pdfviewer>?

hawk ( 2022-05-20 18:35:43 +0800 )edit


<iframe id="report" name="report" width="100%" height="100%" autohide="true" src="@load(vm.source)" sclass="iframeclass"></iframe> source has the link to pdf and when it gets loaded we send a httpresponse to open that pdf file

sjm ( 2022-05-20 19:58:54 +0800 )edit

answered 2022-05-25 16:08:18 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2022-06-01 14:54:57 +0800

I found clicking the mailto link in a PDF file still triggers a beforeunload event which removes zk desktop and stops the client engine.

Since PDF file is out of ZK control, I don't have a way to prevent it. I have 2 alternatives

open a PDF file in a separate browser tab

so clicking the mailto link doesn't affect the original page

show a confirm dialog

set the flag: <script defer="true"> zk.confirmClose = true; </script>

When you click the mail link (or close the browser tab), ZK will pop up a dialog to confirm the closing. If you choose cancel, then zk doesn't stop client engine.

link publish delete flag offensive edit


Hi @hawk, may I ask how this should be done? I ran into the same problem, links from mailto and normal URL both result into a beforeunload event. In your method, should you add the script tag only when you have this scenario or all the time ?

AndreiArdei ( 2022-06-27 18:09:52 +0800 )edit

I think it depends on your design or your users. If your users can accept that each time he closes a tab will show a confirm dialog, then you can add it to all pages.

hawk ( 2022-06-27 19:05:28 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2022-04-21 13:12:01 +0800

Seen: 14 times

Last updated: Jun 01 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More