How to Disable Clicking in an Iframe

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Image Credit: avemario/iStock/Getty Images

An iframe is an HTML element that displays content from an external page. Sometimes, web developers may wish to prevent the user from clicking on an iframe or the contents of an iframe. Typically, clicking on elements is disabled by using Javascript to set the element's "onclick" event to "return false." Unfortunately, there is no onclick event for iframe elements. However, clicking can still be disabled by placing an invisible blocking overlay over the iframe.

Advertisement

Step 1

Type the code

above your