I have an AJAX link that currently loads a partial view into a div. If I use middle click on that link, it will open a new window with the html contents of that partial view only (i.e. no layout, css, scripts, etc). I would like to wire up middle click to open up a new tab but with the whole contents of the web site AND the partial that normally gets loaded by that AJAX call. I’ve tried some things attempting to catch middle click and doing a call to a different action that does load the entire layout but middle click is hard to work with in Firefox so that won’t really work. For example:
$('#myLink').click(function(e){
if( e.which == 2 ){
console.log("middle click");
return false;
}
});
Firefox doesn’t catch that, although it does catch e.which == 1 (left click). Same goes for e.button.
Is there any way to catch this perhaps on the server and redirect to an action that renders the full page as opposed to only the partial? Or any other solution? Thanks!
Use .mousedown instead of .click ^_^
check it out here:
http://jsfiddle.net/C5R7E/2/