|
|
How do I capture the open-in-new-window/tab event?
Hi,
I have a link
<a href="download.pdf">Download</a>
and I'm interested in capturing the event when someone right-clicks on
the link and opens it in a new window/tab. Any advice you have is
greatly appreciated, - Dave
|
|
0
|
|
|
|
Reply
|
laredotornado
|
8/23/2010 6:47:43 PM |
|
Le 23/08/10 20:47, laredotornado a �crit :
> Hi,
>
> I have a link
>
> <a href="download.pdf">Download</a>
>
> and I'm interested in capturing the event when someone right-clicks on
> the link and opens it in a new window/tab. Any advice you have is
> greatly appreciated, - Dave
and if I download the pdf instead of opening it somewhere ?
what is the interest knowing what made the visitor with documents you
serve ?
I'm not sure it can be possible to see what happens on a right-click
because the detecting function will be stopped as soon as the contextual
menu will display
--
St�phane Moriaux avec/with iMac-intel
|
|
0
|
|
|
|
Reply
|
SAM
|
8/24/2010 2:13:39 AM
|
|
laredotornado wrote on 23 aug 2010 in comp.lang.javascript:
> I have a link
>
> <a href="download.pdf">Download</a>
>
> and I'm interested in capturing the event when someone right-clicks on
> the link and opens it in a new window/tab. Any advice you have is
> greatly appreciated, - Dave
A new window/tab can also be forced in many browsers by a shift-click.
I do not see what right you have to know what way I look at the pdf.
So I am glad browser security does not allow you to see that in clientside
javascript.
However, perhaps if you had some "stay-alive" ajax connection to the
server, you could see serverside if the original page was or was not
overwritten by the pdf.
Forcing the page to be on a new window or tab can be done like this:
<a href='download.pdf' target='_blank'>Download</a>
Forcing the pdf to be downloaded and not shown in the browser,
can be done streaming the pdf with serverside javascript,
specifying "attachment":
<% // Javascript presumed
.....
var filePath = 'download.pdf';
var temp = 'attachment;filename=' + filePath;
Response.ContentType = 'application/pdf';
Response.Addheader('Content-Disposition', temp);
.....
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
|
|
0
|
|
|
|
Reply
|
Evertjan
|
8/24/2010 8:33:22 AM
|
|
On Aug 24, 3:33=A0am, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
> laredotornadowrote on 23 aug 2010 in comp.lang.javascript:
>
> > I have a link
>
> > <a href=3D"download.pdf">Download</a>
>
> > and I'm interested in capturing the event when someone right-clicks on
> > the link and opens it in a new window/tab. =A0Any advice you have is
> > greatly appreciated, - Dave
>
> A new window/tab can also be forced in many browsers by a shift-click.
> I do not see what right you have to know what way I look at the pdf.
> So I am glad browser security does not allow you to see that in clientsid=
e
> javascript.
>
> However, perhaps if you had some "stay-alive" ajax connection to the
> server, you could see serverside if the original page was or was not
> overwritten by the pdf.
>
> Forcing the page to be on a new window or tab can be done like this:
>
> <a href=3D'download.pdf' target=3D'_blank'>Download</a>
>
> Forcing the pdf to be downloaded and not shown in the browser,
> can be done streaming the pdf with serverside javascript,
> specifying "attachment":
>
> <% // Javascript presumed
> ....
> var filePath =3D 'download.pdf';
> var temp =3D 'attachment;filename=3D' + filePath;
> Response.ContentType =3D 'application/pdf';
> Response.Addheader('Content-Disposition', temp);
> ....
> %>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
What I am taking from all this, is that it is not possible to capture
a right-click event. The reason I want to know is that we have
analytics software (Omniture) that counts clicks based on the
"onclick" event being fired. However, when people right-click, we are
noticing this event doesn't fire on Firefox or IE.
- Dave
|
|
0
|
|
|
|
Reply
|
laredotornado
|
8/24/2010 1:13:58 PM
|
|
|
3 Replies
777 Views
(page loaded in 0.19 seconds)
Similiar Articles: How to capture and then cancel Tab key event. - comp.lang ...How to capture and then cancel Tab key event. - comp.lang ... How do I capture the open-in-new-window/tab event? - comp.lang ... ... by mouse click or using arrow keys or ... How to detect browser close event - comp.lang.javascript ...... Set style of IFRAME ... have the following problem. ... the new window ... How to capture and then cancel Tab key event. - comp.lang ... Is there a cross-browser way to ... Print prompt window in PowerBuilder - comp.soft-sys.powerbuilder ...How do I capture the open-in-new-window/tab event? - comp.lang ... Now, if I do it the hard way, file>import> screen capture>start it will ... Long delay open print dialog ... How to prevent JPanel losing focus ? - comp.lang.java.gui ...... focus (like switching to another >tab There is an event for ... losing focus (like switching to another tab ... Open new ... Preventing A New Window From Grabbing Focus - comp ... How can I print logged on "user name" on printed records - comp ...If you are opening a filemaker server file, CurrentHost ... of this problem please > The only current way to capture ... Allen www.semiotics.com FM7 Tip of the Day: The new ... capture destination URL in onUnload - comp.lang.javascript ...... and have that trigger a function (on a new ... is negative (browser was closed) open window to ... How to capture and then cancel Tab key event. - comp.lang ... cancel won't cancel on lpstat - comp.unix.sco.miscHow do I capture the open-in-new-window/tab event? - comp.lang ... cancel won't cancel on lpstat - comp.unix.sco.misc Preventing A New Window From Grabbing ... Your current security setting do not allow this file to be ...When I check File->Document Properties->Security, I find the ... are PDF readers that do not ... documents you bought or downloaded from them? Find onUnload Destination URL - comp.lang.javascript... closes the browser window ... to execute onUnload event handlers when you close the browser or the page's tab. In fact, I've only found it do ... is that if customer open new tab ... open another jframe - comp.lang.java.guiHi, How do I open another JFrame from one ... Java window crashes all open browser windows - comp.lang ... Open new ... focus (like switching to another tab ... Open new ... How to easily capture the NewWindow3 event and detect a JavaScript ...How to easily capture the NewWindow3 event and detect a JavaScript window.close() call with System.Windows ... event, capture the URL, and pop open a new tab, directing it ... How to identify opening a new tab event - JavaScript / Ajax / DHTMLIs there any way to identify the event of closing the window or tab, opening a new window or ... Rather than restricting the user opening new windows or tabs, just use a ... 7/25/2012 6:46:42 AM
|
|
|
|
|
|
|
|
|