Ruby/Rails Jquery
Forcing a link to open in a new tab by pressing ctrl + click returns a 404 page when the response is not HTML. I would like to be able to throw an alert that says "This link is not available in a new tab."
What is the best way to accomplish this globally? I have already updated the high-use cases where the action is controlled by a JQuery 'on click' event, but I am looking for a more robust solution.
Example: HTML:
<a href="http://some_link/some_action">some link</a>
CONTROLLER:
def some_action
...
respond_to do |format|
format.js
end
end