Trigger auto click in javascript without clicking

//How can I trigger auto click without clicking, so that it auto show the share dialog

        <button type="button" id="share-button">Share</button>


Insert standard disclaimers about not p***ing people off by clicking on things they dont want to click, etc.

I have tried this method but still cannot auto-click.

<div id="buttons">
        <button type="button" id="share-button" onclick="share()">Share</button>

    window.fbAsyncInit = function () {
            appId: 'ID',
            autoLogAppEvents: true,
            xfbml: true,
            version: 'v11.0'


    document.getElementById('share-button').addEventListener('click', share);

    function share() {
            display: 'popup',
            method: 'share',
            href: '',

        }, function (response) {
            //Debug response (optional)

    window.onload = function () {

    //Load the JavaScript SDK asynchronously
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementsById(id)) return;
        js = d.createElement(s); = id;
        js.src = "";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));


<script async defer crossorigin="anonymous" src=""></script>