We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

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

sandeep226
sandeep226 asked
on
Medium Priority
8,678 Views
Last Modified: 2008-01-09
Hello,

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.
Comment
Watch Question

Author

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!

Commented:
you cant without some mad code

Author

Commented:
Yes, and i am looking for one! :)
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)
http://support.microsoft.com/default.aspx?scid=kb;en-us;241754

Author

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 Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
Load the page though your server and display an image generated of the site or change all links to text.
Beware of copyright issues.

Author

Commented:
Hi mplungjan, could you tell me the script. I am new to programming. thanks.

Author

Commented:
mplungjan, i think what you are telling is exactly what i am looking for. Could you please elaborate. Thanks.
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
You need a server process.
For example using php or asp

then you can do

<iframe="myserverprocess.php?page=http%3A//www.cnn.com"></iframe>

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...
Michel

Author

Commented:
Hi,

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 Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
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

Michel

Author

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 http://www.thumbshots.org. 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?

Author

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, google.com 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 Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
Actually the EXACT opposite of this:

http://www.cs.sfu.ca/~cameron/Teaching/470/webparse.html
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>
</div>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
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

Author

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!

Author

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!

Author

Commented:
The points are yours... and all worth it!!

Great job!

Thanks, and until the next problem....

Author

Commented:
Woops... i almost made a mistake there... all those thanks and praise are for bubbledragon!
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
good you noticed in time :)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.