Search code examples
javascriptinternet-exploreractivex

Is window.history.pushState tied to ActiveX in Internet Explorer 11?


When trying to append to the URL with window.history.pushState, I achieve functionality in Chrome, Firefox, Safari, and Opera, but in my VM, a browser dialogue option pops up in IE asking to enable ActiveX. If I do, I get the desired functionality, but if not, the message will eventually disappear and the browser will have to be reopened. Is there any way to implement it without the use of ActiveX

        <button onclick="myFunc()">Button</button>
...
    <script>
        var myFunc = function() {
            var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?append+to+the+url'; 
            window.history.pushState({ path: newurl }, '', newurl);
        }
    </script>

I expected it to append to the URL immediately, but IE expects the user to enable ActiveX for it to maintain functionality.


Solution

  • I made a test on my side and based on my testing result I was also getting that pop up to allow the ActiveX to make the code work.

    enter image description here

    In further testing, I found that enabling the options for ActiveX also not help to solve the issue.

    After that I try to enable the option called Allow active content to run in files on My Computer in Advanced tab of Internet options.

    enter image description here

    It solved the issue for IE and now there is no any pop up for allowing ActiveX and code is working fine.

    Output in IE 11:

    enter image description here