-
AuthorPosts
-
February 24, 2026 at 6:07 pm #1495445
Hi, I ‘m trying to have my pdfs load in a lightbox. I have tried 2 methods – the first being adding this code which didnt work. The second thing I treid (which I prefer) is the adding the plugin ARI Fancy Lightbox. But the same things happens and it is just black and the pdf wont load.
February 24, 2026 at 10:07 pm #1495451can you try this:
place that snippet inside your child-theme functions.php:function lightbox_with_mixed_content_type() { ?> <script type="text/javascript"> window.addEventListener("DOMContentLoaded", function () { (function($){ $('.mixed-contenttype a').each(function(){ var anchorLink = $(this).attr('href'); if (/\.(jpg|png|gif|webp|jpeg)$/.test(anchorLink)) { //console.log(anchorLink + " is an image link"); } else { $(this).attr('rel', 'lightbox').addClass('mfp-iframe'); } }); })(jQuery); }); </script> <?php } add_action('wp_footer', 'lightbox_with_mixed_content_type', 999);on your page place a button and give that custom class to the elment (or to one parent element) : mixed-contenttype
now link to your pdf.
See: https://webers-testseite.de/pdf-in-lightbox/
But: Not all browsers will display this, especially mobile browser variants.INFO: due to GDPR ( DSGVO in Germany ) i can not show the working script for video content – it is hard to block this – playing videos from a masonry or from an image linked to a video.
February 27, 2026 at 9:50 pm #1495581HI, i’m still having an issue with this ticket. I have provided a temp login in the private area.
February 28, 2026 at 4:44 pm #1495607Hi,
You have a server error:Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.Typically this is an Incorrect Server Configuration: The server is not serving .js or .wasm files with the correct MIME types.
Configure your server to set the proper Content-Type header.
Apache: Add AddType application/javascript .js to .htaccess or httpd.conf
Since each webhost is different, please ask your web host support to help, we are not experts on each host setup.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.
