Hello everyone

I try to achieve the following: ensure that by left-clicking on an element of a page, it is the behavior of a right click. Keeping the normal behavior of the right click.

I developed the following code, which seems to work well on Linux but did not have the desired effect on some elements in microsoft windows:

Code:
var func1 = function(element, event)
{
    cancel(event);
    var evt = element.ownerDocument.createEvent('MouseEvents');
    var RIGHT_CLICK_BUTTON_CODE = 2;
    evt.initMouseEvent('contextmenu', true, true, element.ownerDocument.defaultView, 1, event.screenX, event.screenY, event.clientX, event.clientY, false, false, false, false, RIGHT_CLICK_BUTTON_CODE, null);
    element.dispatchEvent(evt);
    cancel(event);
};     

var func2 = function(Event)
{
    if(Event.button == 0)
    {
        cancel(Event);
        var element = Event.srcElement||Event.target;
        func1(element, Event);
        cancel(Event);
    }
};

var cancel = function(event)
{
    if(event.stopPropagation())
        event.stopPropagation();
    else
        event.cancelBubble = true;
    event.preventDefault();
    event.returnValue = false;
    return false;
};
With certain elements such as google search results I have the context menu by left-clicking as desired but the left click has its normal behavior and then redirects me to the site.

And with Linux, I do not have this problem.

Could you help me?

Regards.