JavaScript - block links on iframes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nery89
    New Member
    • Oct 2012
    • 1

    JavaScript - block links on iframes

    Ok, this post is not really a question, but I didn't find a way to reply on an existent post. Javascript is NOT needed, anyway it can be disabled by the user. So this is THE UNIVERSAL solution (to my question...!):

    Code:
    <[B]div[/B] class="positioner"  style="width:402px;height:302px;border:none;margin:50px auto">
    	<[B]iframe[/B] src="thelinker.html" style="[B]position:absolute;[/B]width:400px;height:300px;border:1px solid #222;overflow:hidden"></iframe>
    	<div style="[B]position:absolute;[/B]width:400px;height:300px;border:1px solid #fff;background:#fff;opacity:0.001"></div>
    <[B]/div[/B]>
    
    <div class="positioner" style="width:402px;height:302px">
    	<iframe src="thelinker.html" style="position:absolute;width:400px;height:300px;border:1px solid #222;overflow:hidden"></iframe>
    	<div style="position:absolute;width:400px;height:300px;border:1px solid #fff;background:#fff;opacity:0.001"></div>
    </div>
    To work, absolutely you have to decide the size of the iframe. In this case 400 x 300 (px) + 1px of border.

    The "positioner " is needed to know the origin of iframe.

    Opacity property is needed for IE. Else nothing will work.

    I tested it on all major browser but I can't know about IE < 8.
    Last edited by Dormilich; Oct 23 '12, 09:19 AM. Reason: removed link
Working...