Trigger ajax action by url or link
The easiest option would be to add an ID to each link like link_printer and then use jQuery to parse the url, get the last fragment, and click any links that match.

var splitURL = window.location.href.split('/');
var link_id = '#link_' + splitURL[splitURL.length - 1];
if ($(link_id).length &gt; 0) document.querySelector(link_id).click();