i want my html page triggers & shows the native, default context menu on page load as if a human user has clicked on a div which has an ID in internet explorer 11.
more specifically, my div has a SVG. If a right-click it on IE11, it shows the context menu "share image, save as image etc.."
My best try is below and it's not working.
IE11 console says "SCRIPT5007: SCRIPT5007: Unable to set property 'onmousedown' of undefined or null reference".
Firefox console gives no error.
- Why is it not working?
- How to achieve my purpose on Internet Explorer?
jsbin representation of my exact source code:
https://jsbin.com/fepeqetegu/edit?html,output
thanks.
<body>
<div id="target">
<!-- a SVG content -->
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$("document").ready(function() {
setTimeout(function() {
$("#target").triggerHandler('contextmenu');
}, 100);
});
</script>
</body>