Disable Right and Left Click inside Iframe


I got a website with frames.

The main frame contains two frames ‘top’ and ‘bottom’.

Now I have an iframe inside the bottom frame. And it is linked to an external website. However, I wish to disable clicking on any of its links (both right and left) inside the iframe. Could you please tell me the code to do so.

Ps: I am an utter newbie to webpage development or programming.
:frowning: :frowning: :frowning:

Left clicking on something and using the keyboard to give that something the focus and then pressing enter are two of many ways to achieve the same result. There is no way of writing anything that will block all of the different ways and even if you do your visitors will be able to reneable the functionality if they want to.

Right clicking brings up the context menu the same as the contextmenu button on the keyboard does (the key between the right windows and ctrl keys). Modern web browsers don’t allow you to block this function and where it is allowed the person visiting your page can always re-enable it. Also all of the options in that menu are also available from elsewhere in any case.

You should design your page so that it doesn’t matter if people click rather than wasting time blocking newbie web users from some of the options that they use to navigate the web - and hence driving them away from your site - while not impacting on experienced web users at all.

I understand that one can re-enable a disabled option. But we will leave it for the smart guy.

I need the disabling feature for a normal user.

Also, I don’t want one to click inside the small IFRAME and then see some other page - which is meaningless.

I want the webpage being rendered inside the IFRAME to have a plastic feeling. No right or left click.

Normal users hate it when web sites interfere with the normal functioning of their browser because they end up being unable to use the options that they normally use to navigate between sites.

Why not design the iframe content so that it functions the way that you want it to in the first place rather than trying to override functionality after the page has displayed.

I think, the point on functionality does not arise as you do not understand the purpose of the site. So let us not delve into it.

All i need is something like a live screenshot of a page from another domain on my page. - Absolutely NO copyright issus either.

That’s it. Only a javascript that will reproduce the page. Nobody being able to click on the iframe page. :rolleyes:


I’m with felgall on this one, but we don’t know what your use for it is, so…

I guess a very rough and dirty way could be to position a transparent gif over the iframe. It would still give you a right click, but for the image and any links on the page in the iframe would not be clickable.

I’ve no idea if it would actually work as i’m thinking, but it’d be worth a try.

Cool ShEx,

Just how do u do it? it sounds interesting. And people, pls keep away from the functionality part… that is not important in this case - trust me!!! :smiley: :smiley: :wink:

What would a typical iframe plus gif image code look like??

Thanks for your efforts once again! :slight_smile:

http://www.thumbshots.org. Was browsing around and came across this site.

Maybe there are those who are like me. It seems to be an answer to what i am looking for.


I usually try to give answers that help the person achieve the desired result rather than necessarily answering the particular question that is asked. Most times when people ask about disabling mouse clicks it has to do with attempting to protect content - which can’t be done. If you tell us why you think blocking the mouse buttons is required I can probably tell you what you should be doing instead.

Hi Mirage, I know it’s an old thread, but on searching around, your thread could be useful to me as well.

I clicked on that link above - how does that help ? Anyway, did you manage to solve the problem ?