Search code examples
phphtmlhtml-object

Disable interactivity of html object that's previewing a website


I'm loading in a preview of a website with the following code:

<object class="preview" type="text/html" data="<?php echo the_sub_field('prototype'); ?>"></object>

Is there a way to disable interactivity with the elements within that link? I want to load a preview of a link but I don't want users clicking around and interacting with the preview if that makes sense.


Solution

  • You can use css pointer-events. It would look something like this:

    .preview {
        pointer-events: none;
    }
    

    For browser support check out: caniuse.com/#feat=pointer-events

    You should also look at iframe if you want to show another website (it has several security features).