I have a modal that pops up when the site detects it's on IE11. The modal is in a cms block so that the client can edit it. I have created a reference container with a custom phtml and put the script in there. But it's not working! Is this because the script is in a phtml file? and if so can I call a block using php in a js file? Please note that I'm trying to detect chrome in this example as I'm on a mac.
<script type="text/javascript"> document.addEventListener("DOMContentLoaded", function(){ if (!navigator.userAgent.includes('Chrome')) { <?php echo $this->getLayout() ->createBlock('Magento\Cms\Block\Block') ->setBlockId('dontuseie') ->toHtml(); ?> } }); </script>