开发者

Displaying a PDF then closing if not active for a period of time

开发者 https://www.devze.com 2023-01-26 08:16 出处:网络
One of my clients wants to click on a link to load a pdf. The pdf will load in a new browser window. All ok. My client then wants the window to close if the pdf is not used for a period of time.

One of my clients wants to click on a link to load a pdf. The pdf will load in a new browser window. All ok. My client then wants the window to close if the pdf is not used for a period of time.

I was planing on using the JQuery Media Plugin to display the pdf. In the browser I can have timer and if .mousemove() is cal开发者_运维百科led I can reset the time.r However I don't know if moving the embed pdf will call the event to be called.

Can you think of any other ways I could do this?


As far as I can see, there is absolutely no way to do this from within the browser. Your mouse events will not fire in the area of the PDF plug-in, nor will you have any other kind of access there.

The only way this might be possible is using Javascript within the PDF. But that would require you to prepare every PDF document that will be shown - if it's possible at all.


A sneaky way that you might be able to get this to work is to load the PDF in Google Doc Viewer (http://docs.google.com/viewer) and then put an invisible DIV over it to intercept interaction. Not really sure if it's possible to do that, but it would be the most viable, as you can't even be sure what kind of PDF plugin the user is running (Adobe, FoxIt, some Linux app, etc.).

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消