If you happen to come across this question, although it's old...
When it comes to iFrames
, they essentially contain a separate DOM within the main DOM. CSS properties like pointer-events
may not always work as expected with iFrames and can behave differently depending on the browser.
You can attempt to affect all content WITHIN the iframe by using
iframe > * {pointer-events: none;}
, but if the contents of the iframe are from different domains, this method is most likely ineffective.
The use of pointer-events: all;
is primarily designed for SVGs exclusively and may not apply in the same way to other DOM elements.
In order to resolve the issue, the OP should consider either adjusting the size of the iFrame to fit the content or eliminating the use of an iFrame altogether.
Alternative methods for embedding content include:
Using HTML <embed>
- Check out the documentation
Utilizing HTML <object>
- Refer to the guide
Exploring Web Components HTML Imports (though now deprecated, a polyfill is available)
While none of these options are perfect solutions, they could potentially address the issue at hand based on the specific circumstances.
Furthermore, employing a Javascript function to populate an element with external content is another viable approach. In essence, this mirrors how "Single Page" Apps developed using React/Angular/Vue operate behind the scenes. Note: When adopting this method, ensure that you adhere to CORS headers
requirements if sourcing content from a distinct domain.