Can I show a modal from head_tag

Hi Sam, I have a similar question.

For our site, we have only utilized the head_tag to customize it. Previously, we utilized magnific with jQuery and iframe to populate a modal with interactable list items from a separate domain, but we reasoned that Discourse has finally officially phased away from magnific/jQuery recently because clicking on the same links produces nothing (nothing in the console either).

So I’m looking for the next best option. Can you confirm that using DModal is the most appropriate option for my needs? Any assistance would be super helpful!

Here is some code we used to attach magnific popup triggers.

   if (window.jQuery) {
        const $document = $(document)
        $document.on('click', '.otpc-magnific-trigger', function() {
            var $button = $(this)
            if ($button.hasClass('initialized')) {
                $button.magnificPopup('open')
            } else {
                $button.magnificPopup({
            		type: 'inline',
            		preloader: false
            	})
                $button.magnificPopup('open')
                $button.addClass('initialized')
            }
            return false
        })