Closed bogal closed 7 years ago
This is a section of code i use to grab available printer list and also works to detect if JsPrintSetup is loaded also. I'm sure there may be better ways but this way does work.
try
{
var content = jsPrintSetup.getPrintersList();
window.location.href = "User_Edit.php?name=" + content;
}
catch (exception)
{
console.error(exception);
window.alert('Your browser is not supported for client side printer selection or printing at this time, sorry.');
window.location.href = "User_Edit.php?name=null";
}
At first you can check whether jsPrintSetup
addon is installed and suggest installation.
jsPrintSetup_CBIntall = function(name, result){
if(result == -210){
alert('Install of Extension: \n'+name+'\n was canceled.\n Result: '+result);
} else {
alert('Extension: \n'+name+'\n was installed sucessfully.\nResult: '+result);
}
} // jsPrintSetup_CBIntall
function jsPrintSetup_checkInstall() {
if (typeof(jsPrintSetup) == 'undefined') {
if (confirm('Do you want to install jsPrintSetup?')) {
var xpi = new Object();
xpi['jsprintsetup'] = 'https://addons.mozilla.org/firefox/downloads/latest/js-print-setup/addon-8966-latest.xpi';
InstallTrigger.install(xpi, jsPrintSetup_CBIntall);
}
}
}
Another thing to consider is Access Control, here can find how to check it.
Is there any way to detect whether the browser has JsPrintSetup installed or not?