[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5016
  • Last Modified:

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

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.
0
sandeep226
Asked:
sandeep226
  • 12
  • 6
  • 3
  • +1
1 Solution
 
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!
0
 
LakioCommented:
you cant without some mad code
0
 
sandeep226Author Commented:
Yes, and i am looking for one! :)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
bubbledragonCommented:
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
0
 
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.
0
 
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.
0
 
sandeep226Author Commented:
Hi mplungjan, could you tell me the script. I am new to programming. thanks.
0
 
sandeep226Author Commented:
mplungjan, i think what you are telling is exactly what i am looking for. Could you please elaborate. Thanks.
0
 
Michel PlungjanIT ExpertCommented:
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
0
 
sandeep226Author 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!
0
 
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

Michel
0
 
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 http://www.thumbshots.org. Seems to be what i am looking for. Let me try.

Thanks for ur help!
0
 
bubbledragonCommented:
Hi, sandeep

I have two question about you Iframe is (1) fixed size  and (2) no scrollbar?
0
 
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, 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
0
 
Michel PlungjanIT ExpertCommented:
Actually the EXACT opposite of this:

http://www.cs.sfu.ca/~cameron/Teaching/470/webparse.html
0
 
bubbledragonCommented:
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>
0
 
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
0
 
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!
0
 
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!
0
 
sandeep226Author Commented:
The points are yours... and all worth it!!

Great job!

Thanks, and until the next problem....
0
 
sandeep226Author Commented:
Woops... i almost made a mistake there... all those thanks and praise are for bubbledragon!
0
 
Michel PlungjanIT ExpertCommented:
good you noticed in time :)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 12
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now