Regarding the inquiry mentioned in the question title.
Is it possible to prevent individuals from executing functions on my webpage using the console, even though it is not necessary?
I have experimented with various methods, and the code below represents the closest I have come to a solution - unfortunately, it does not work as intended :(
window.onresize = function(){
if((window.outerHeight - window.innerHeight) > 100) {
//stop commands here?
}
}
window.onload = function() {
if (typeof console !== "undefined" || typeof console.log !== "undefined") {
if (window.console && (window.console.firebug || window.console.exception)) {
//stop commands here?
}
}
}
EDIT:
I do not necessarily need to disable the console entirely; I just want to prevent function calls being made within it - either solution would suffice ;)
EDIT2:
So, as it stands, there seems to be no foolproof way of detecting the console across different browsers. Is this correct?
EDIT3:
As a temporary workaround, I have implemented the following approach. Although the JavaScript functions remain intact, the associated elements have been removed... It's not an ideal fix, but it will serve its purpose for now... :(
setInterval(function() {
if (!$.browser.mozilla) {
if((window.outerHeight - window.innerHeight) > 100) {
alert("DISABLED!");
$('body').remove();
return false;
}
}
if (window.console && (window.console.firebug || window.console.exception)) {
alert("DISABLED!");
$('body').remove();
return false;
}
}, 750);