How to disable all clicks in iframe?

Member

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

How to disable all clicks in iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by rollin , 6 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.

Related Threads:

How to enable middle-mouse clicks on iframe?
How to disable iframe from javascript?
How to disable toolbar in iframe?
How to disable right click on iframe?
How to disable scrolling for an iframe in chrome?
How to disable autoplay video in iframe?