How to disable clicking inside an IFRAME where the content is loaded from an external domain?


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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sandeep226Author Commented:
Just to add to my earlier post.

I need the page being rendered inside the IFRAME to have a plastic like feeling. No right or leftt click. Only view the page. That's it.

PS: I am new to javascripts or webpage development. So please try to give answers as if answering to a newbie! Thanks!
you cant without some mad code
sandeep226Author Commented:
Yes, and i am looking for one! :)
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

What the meaning for external website?

If it's in different domain, for browse security, you cannot access the frame, you will get "Access is denied" when Scripting Across Frames.

To Create Cross-Frame Scripting-Capable Web Pages with HTML Applications (HTAs);en-us;241754
sandeep226Author Commented:
yes it is from a different domain. And there are quite a few scripts online that display content from an external domain.

However, what i want is that none of the links on the external page be clickked.
Michel PlungjanIT ExpertCommented:
Load the page though your server and display an image generated of the site or change all links to text.
Beware of copyright issues.
sandeep226Author Commented:
Hi mplungjan, could you tell me the script. I am new to programming. thanks.
sandeep226Author Commented:
mplungjan, i think what you are telling is exactly what i am looking for. Could you please elaborate. Thanks.
Michel PlungjanIT ExpertCommented:
You need a server process.
For example using php or asp

then you can do


then in the myserverprocess.php you need to find all links - look for href and onClick and location.
and change them all to myserverprocess.php?page=whatever
or # for example.

Alternatively you can run a browser on your server and take a snapshot with some server software..

I need more information on what you want and what your server can do and what YOU can do with server coding...
sandeep226Author Commented:

am creating something in normal html. frankly, i have no idea of php or asp. but have some idea of html, javascripts too.. to an extent. so i was hoping that using the basic html stuff, i can create an iframe of a page - no copyright issues.

The only criteria is, that no one should click on a single link on that page. Something like capturing a live screenshot of a page and posting it. Thats it.

Thanks once again!
Michel PlungjanIT ExpertCommented:
If the user will let you, you can get the page using xmlhttp and change the links then. But the user must allow external pages to be grabbed

Have a search for xmlhttp

sandeep226Author Commented:
Hi, th user is allowing me to grab the page?

as usual i did not understand what is xmlhttp. But will find out on the net.

I cam across Seems to be what i am looking for. Let me try.

Thanks for ur help!
Hi, sandeep

I have two question about you Iframe is (1) fixed size  and (2) no scrollbar?
sandeep226Author Commented:
hi, so i give up on thumbshots as an answer.

that is not what i am looking for.

can someone give me a simple code that will fit say, as an example, in an ordinary html page - tucked inside a cell onto the right hand side of the page. with no one being able to click on it or search from it. But the site ought to be visible.

It preferrably should be of a fixed dimension and no scrollbar.

That's it... frankly
Michel PlungjanIT ExpertCommented:
Actually the EXACT opposite of this:
How about this? Just for iframe without scrollbar.

First, you must create a 1px clear dot gif.

then, Two objects inside the framearea div, you can control the height or width on this area

The framecover div is stored the dot gif and use to cover the iframe

User cannot click anywhere, because the dot gif is over the iframe.

<div id="framearea" style="height:200px;width:200px">
<div id="framecover" style="position:absolute; z-index:2; height:100%; width:100%"><img src="dot.gif" width="100%" height="100%" BORDER="0" onmousedown="this.oncontextmenu=new Function('return false')" onmouseup="this.oncontextmenu=new Function('return false')"></div>
<iframe id="mainframe" scrolling="no" src="b.html" frameborder="0" STYLE="position:absolute; z-index:1; height:100%; width:100%"></iframe>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
Bravo. I was thinking of that but was sure it would not be possible for some reason.

Actually loading CNN into that frame gives a LOT of errors and if it had a frame breaker script, the page would of course not stay in the iframe
sandeep226Author Commented:
great. I will implement the same and comment on it by tomorrow. it is almost 1am in india now! Thanks for all the help mplungjan!
sandeep226Author Commented:
Hello Michel,

U've done it my friend!

Am increasing the points for you from 125 to 500. Let me test it.. Just a little problem with the gif image creation.....

Thanks a million buddy! Thanks!
sandeep226Author Commented:
The points are yours... and all worth it!!

Great job!

Thanks, and until the next problem....
sandeep226Author Commented:
Woops... i almost made a mistake there... all those thanks and praise are for bubbledragon!
Michel PlungjanIT ExpertCommented:
good you noticed in time :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.