Why right clicking inside IE browser stops javascript

I wrote simple javascript animation code. When I right-click on a document, javascript animation stops and resumes only when the context menu closes. This only happens in IE, and the animation continues if I do the same in other browsers.

I was wondering if there was any work for this to keep the animation going even when the context menu is open.

I searched googled and all I could find was:

  • Disable Right Click
  • Create a custom context menu

But I could not find the reason why this happens only in IE.

Can someone explain why this only happens in IE, as well as a possible solution for this (if any)?

Edit: I checked IE7, IE8 browsers in windows

+4
source share
1 answer

There is an event called oncontextmenu. It calls the desired function when the right button is pressed. For instance:

<html> <head></head> <body oncontextmenu="document.write('hello');"> </body> </html​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​>​​​​​​ 

Just try calling the function to run the animation twice - once at the start of the page, and then through oncontextmenu.

UPDATE

Mark it ! The script here prevents the initial context menu from appearing during the animation. This is how much I can get ...

+1
source

Source: https://habr.com/ru/post/1411686/


All Articles