samedi 3 décembre 2016

How can I make a javascript link openable via middle-click?

My webpage works with a lot of data which is uploaded by the user, processed by the server and then returned back. Sometimes, the user will want to filter part of the data so the server would process only a subset of that data. So my webpage has a nice 'filter' button which filters according to the client's state.

Long story short: my clients want to be able to middle-click that button so it opens in a new tab.

I'm a big believer in letting the user deciding how to open their links, so I wouldn't want this filter button to open a new window automatically. But I can't turn it into an [a href] link, because I need to run the JS filter first.

So the question becomes, how can I make a link which runs some code before opening?




Aucun commentaire:

Enregistrer un commentaire