Does anyone know how I could make an iframe so that the links in the
frame page are disabled ... or if this is possible?
Any help is appreciated.
Assuming you have zero control over the content of the iframe, you can
cover it with an invisible div. Compatibility varies-- some browsers (I
can't remember which) have problems showing a div on top of an iframe.
In some browsers, whitespace may be considered to not be there-- get
around this by filling the invisible div with an invisible image.
Of course... then they can't click on anything in the iframe.
If the iframe is not under your control but IS on the same domain, you
can loop through its links
for( var c = 0; c < document.links.length; c++ )
And set their onClick to return false.
document.links[ c ].onclick = function () { return false; }
The problem is that anything other than links can also have an event
handler that does something similar to a link, such as:
<font class=looksLikeLink
onclick="location.href = 'somepage.html';"