I'm creating website in Gatsby.js, and I want to open widget from Booksy, by onClick method. They gave me a script:
<script src="https://booksy.net/widget/code.js?id=9178&country=pl&lang=pl"></script>
How can I do that? Function document.write() doesn't work, its blocked by browser. I also tried conditional rendered iframe it works, but badly.
const StyledIframe = styled.iframe`
    width: 100vw;
    height: 100vh;
    position: absolute;
    z-index: 99999;
`;
const BooksyWidget = ({ isOpen }) => {
    const src = "https://booksy.com/widget/index.html?id=9178&lang=pl&country=pl&mode=dialog&theme=default"
    const Content = () => {
        return isOpen ? <StyledIframe src={ src }/> : null 
    }
    return (
        <>
            {Content()}
        </>      
    )
};
I want to get result when clicking 'Make an Appointment' button like on this website: http://gentlemanbarber.pl/ I guess my Iframe method can't provide this. So how can i do it?
 
     
    