0

I have come across some legacy javascript code and I found couple of snippets of code like this:

//First One
function document.oncontextmenu()
{
    return;
}

//Second One
function window.onload() {
//some code here
}

I am confused if this is working and if yes what is it really doing? Code was written to only support IE back in the day. I have no means of verifying if this code is working or just useless sitting there. Does this make sense to anyone?

Cœur
  • 37,241
  • 25
  • 195
  • 267
sayayin
  • 971
  • 5
  • 23
  • 36
  • This isn't valid JS, if you need to target specific IE versions there are better ways of doing it (if, as you say, this even worked in the first place). – Paul S. Oct 05 '17 at 23:00
  • Yes, I understand that. It is not my code but I am not sure if this can be doing anything. So just curious if there is something there and for some reason this works in old IE browsers. – sayayin Oct 05 '17 at 23:02
  • 15y ago? All is possible: http://forums.mozillazine.org/viewtopic.php?f=3&t=5428 and https://msdn.microsoft.com/en-us/library/ms536914(v=vs.85).aspx google google google – Roko C. Buljan Oct 05 '17 at 23:07
  • haha yes Im sure the application is that old. I did google google and google but did not see much on it. Anyways thanks for the confirmation that this is not valid javascript that will work in modern browsers. Don't think it even works in newer IEs or Edge. – sayayin Oct 05 '17 at 23:53

0 Answers0