When I press CTRL + P on my view, a JavaScript code is triggered. The code works perfectly on all browsers except Mozilla; I cannot seem to block the Print Dialogue on that browser. Is there something wrong with my code?
I have been attempting to implement my own logic for printing using Ctrl + P (especially when multiple i frames are present on the page). After spending hours trying to achieve this, I resorted to blocking the print dialogue on Mozilla. However, it seems that Mozilla still displays the Print dialogue unlike IE 11, Edge, and Chrome.
$(document).bind("keyup keydown", function (e) {
if (e.ctrlKey && e.keyCode == 80) {
var browser = navigator.userAgent.toLowerCase();
if(browser.indexOf('firefox') > -1)
{
return false;
}}
}
My goal is to prevent the default behavior of CTRL + P on Mozilla and run my custom script instead.
This issue pertains to an MVC web app, in case that information is relevant.