How can an iframe be disabled using Javascript, such that the user is unable to interact with the iframe's contents (i.e. scrolling, selecting, dragging, etc)? For example, a Google map in an iframe can normally be dragged and zoomed. How would these actions be prevented?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
If you're wanting to disable mouse interaction, this should work.
Put a DIV over the top of your iframe, like so (replace top, left, width and height values with your own):
and when you want to disable the iframe, do this in javascript:
I don't know if you can use the
disabled
property like input elements, but you could disable mouse interaction by placing an element over theiframe
, though this doesn't stop a user from tabbing to it.Probably the best bet is to set the
src
attribute to blank, but this will make theiframe
blank, not blurred.