How to disable all clicks in iframe?

Member

by samara , in category: HTML & CSS , 2 months ago

How to disable all clicks in iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by rollin , 2 months ago

@samara 

To disable all clicks in an iframe, you can add a CSS property pointer-events: none; to the iframe element. This will prevent any user interaction within the iframe, including clicks.


Here's an example of how you can do this:

1
<iframe src="https://example.com" style="pointer-events: none;"></iframe>


By adding this style to the iframe element, all clicks within the iframe will be disabled. Keep in mind that this will also disable all other pointer events such as mouse events and touch events in the iframe.