#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    Onclick doesn't fire when CTL-key is pressed


    I am using a simple ajax routine to notify a server of click thrus. This routine passes information about each link on a page when it is clicked to the server which logs information about the click thru. The code works fine unless the CTL key is pressed as someone might do in order to open the link in a new window/tab. Firerfox handles this situation fine. But IE does NOT fire the onclick() routine in this instance.

    This appears to be a problem inherent in every version of IE I have tested so far. It may also be an issue with other browsers.

    The code for the construction of each click thru/link is comprehensive, passing a good deal of data to the server (account #, target url, anchortext, source page, etc.). Is there a simple way to force IE to fire the onclick event when the CTL key is pressed?

    I know I could give every link a unique id but tracking the data on every page to each link dynamically sounds troublesome to say the least. What events fire in IE on a CTL-click?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0
    The answer is to use mousedown for this instead of onclick. This works for my purposes and is apparently how Google and Bing handle click tracking as well.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    20
    Rep Power
    0
    onKeypress?

    onkeydown / onkeyup
    onfocus...

    onkeypress write a function?

    I am new to js so bare with me

IMN logo majestic logo threadwatch logo seochat tools logo