Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am unable to disable a IFrame showing a website. I have used
JavaScript
document.getElementById("iFrameID").Disabled = true;

in javascript but it is not working. I have three iframes on my page showing the status of live alarms from another website. i do not want users to click any of links available in the src pages of all iframes. Please help it is very urgent.

Regards,
Atif
Posted
Updated 16-Aug-12 11:13am
v2
Comments
Sergey Alexandrovich Kryukov 16-Aug-12 17:15pm    
I don't think it can be disabled. Why?
--SA

I don't think it can be disabled. How it would render the content if it was possible? Disabling is applicable to controls.

If you want, consider hiding it.

This is how can you do it with visibility attribute:
http://www.w3schools.com/jsref/prop_style_visibility.asp[^].

And this is how you can do it with jQuery (highly recommended):
hide: http://api.jquery.com/hide/[^],
show: http://api.jquery.com/show/[^],
toggle: http://api.jquery.com/toggle/[^].

If you need to learn jQuery, please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://docs.jquery.com/Tutorials:How_jQuery_Works[^],
http://docs.jquery.com/Tutorials[^],
http://docs.jquery.com/Main_Page[^].

—SA
 
Share this answer
 
Comments
Kenneth Haugland 16-Aug-12 20:19pm    
5'ed. You always give good answers :) Well, nearly alway anyway ;)
Sergey Alexandrovich Kryukov 16-Aug-12 20:53pm    
Thank you very much, Kenneth.
--SA
Abdul Quader Mamun 16-Aug-12 22:27pm    
good approach to Answer!
Sergey Alexandrovich Kryukov 16-Aug-12 23:03pm    
Thank you, Abdul.
--SA
Abhinav S 16-Aug-12 23:21pm    
Good links. 5.
Here is an idea: Place something above your IFrame that intercepts user input

Style zIndex Property[^]

This might help:
event.stopPropagation()[^]

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Kenneth Haugland 16-Aug-12 20:20pm    
5'ed
Espen Harlinn 17-Aug-12 4:07am    
Thank you, Kenneth :-D
Sergey Alexandrovich Kryukov 16-Aug-12 23:03pm    
Another idea; voted 5.
--SA
Espen Harlinn 17-Aug-12 4:07am    
Thank you, Sergey :-D
Abhinav S 16-Aug-12 23:21pm    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900