Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6976051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:26:50+00:00 2026-05-27T17:26:50+00:00

I currently made a link that I attach the click event to ajax some

  • 0

I currently made a link that I attach the “click” event to ajax some content. How do I make it so that the user can open it in a new window or tab if they want (either through context-menu or shortcuts)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:26:51+00:00Added an answer on May 27, 2026 at 5:26 pm

    If you provide a valid href-attribute, users should be able to open the link in a new tab by selecting “Open in new tab” from the context menu.

    To detect if a user clicked on the link while holding down any “special key” (e.g. alt, shift, “meta”, this last one is the one you want I guess), use the click event’s properties provided by jQuery: see this example on jsfiddle and the respective section in the jQuery docs. Hope it helps to catch the CMD-clicks commonly used to open a link in a new tab/window.

    $("a").on("click",function(e){
        if(e.metaKey) {
            // the user probably wants to open the link in a new tab
        } else {
            // simple click, so do your AJAX call here
        }
    });
    

    Also, see this “Key event properties” table for more information. Seems jQuery sets the metaKey property to event.ctrlKey if its undefined (search for “metaKey” in jQuery’s source).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a community site that I run that is made up of
I am trying to make a 3d transition/transformation so that when a link is
Our application is currently made up of two big entities: C# ASPX files, and
I am currently doing a code review and the following code made me jump.
I'm currently working on a semantic web e-learning project. I've made an ontology and
For several applications I made for my current client I have shared user accounts.
I'm dealing with an issue with my current employer that has seriously made me
Good evening, I made a well working function with php, mysql and ajax. A
I'm trying to figure out the best way to make an AJAX call to
I have a -link element that has href link to page, but I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.