• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting HREF attribute when right clicking on a link

 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am trying to do, is to disable the context menu ( which seems fairly easy), but enable it selectively only when the user right clicks on a link, in which case I want to give the user the option to open the link in a pop up window which will have the address bar disabled.

Target Browsers: IE and NN, there is a fair bit of control over the browsers to be used.

Oh..and because I will be adding it to a large no. of existing pages, I cant use onClick events in the actual links, but need something like a document level event handler.

Is this even possible?
If not, I wont waste any more time on it.
If it is, How do I go about recoginizing that the right click happened over a link, and what the HREF attribute for that link is?

The code I am using to disable the context menu is -



This is basically a stop-gap measure to force an average user to use the application through the links provided and stop them from entering possibly invalid values directly through the address bar.


Thanks a lot.

Sonny
[ August 22, 2004: Message edited by: Sonny Gill ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.quirksmode.org/js/events_properties.html

There is a a section that shows you the code to determine what element was clicked, see if that helps you.'

Eric
 
Sonny Gill
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric. That looks very interesting, and for a change, the difference in code for IE and NN is somewhat makeing sense . I will try to work on that.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic