2 useful tricks with html frames

Couples of days ago I had to make few tricks with frame and iframe tags. I suggest this can be useful for many webmasters, especially for those who work with ads.

Trick 1: Page is built in frame on another site without your previous agreement. Remove this stupid frame.
Many don’t fancy frames because of bad usability. But I give you the decent reason to don’t like them: some smart guy can make a frameset in one frame of which your pages would be opened and his content would be shown in other frames, like his ads. Not bad for him, is it? No need content anymore!

The decision I chose:

<script LANGUAGE="JavaScript">
<!--
if (self.parent.frames.length != 0) self.parent.location=document.location
// -->
</script>

And other variants are listed in articles “Frame Breaking JavaScript Code” and Breaking out of frames.
You’ll find curious ones, that tells you how to stop loading alien site and open your own in new window!

Hint: you can use this trick to remove frames from image searches of Google, Yahoo and Live.com (MSN).

Trick 2: How to open iframe as full parent page like there is no iframe at all.
If you just use iframe with width=100% & height=100%, two scrollers will be hard not to notice - iframe’s scroller, and disabled main page scroller. It’s too plain and, moreover, sometimes it’s necessary to open your pages from another site and make it unnoticeable for surfer.
The decision (taken on zvonko.biz):

<html>
<title> zvonko.biz - full window iframe example</title>
<body style="overflow:hidden;margin:0px;">
<iframe style="width:100%;height:100%;border:0px;overflow:auto;" src=" http://www.google.com/search?hl=en&lr=&safe=off&q=test&btnG=Search ">
</iframe></body>
</html>

Working example: http://zvonko.biz/files/no-scroll-ie.html

Tags: Google tricks, Adwords tricks, Yahoo tricks, MSN tricks.

6 Comments »

  1. Faiz said,

    January 20, 2007 @ 8:30 am

    That’s superb… But will it work on all browsers?

    Faiz

  2. samlowry said,

    January 20, 2007 @ 10:48 am

    Of course.

  3. Ryan said,

    September 12, 2007 @ 6:10 am

    HI there =)

    The example link doesn’t work..

    Also, when I tried the code in my browser, the iframe won’t auto-fit when I resize my browser. Is there any way to change that?

    Thanks!

    Ryan

  4. html working with frames said,

    April 7, 2008 @ 7:07 pm

    [...] For those of you that are interesthttp://news.yahoo.com/s/prweb/20080324/bs_prweb/prweb796114_42 useful tricks with html framesCouples of days ago I had to make few tricks with frame and iframe tags. I suggest this can be [...]

  5. alan said,

    April 10, 2008 @ 5:56 pm

    Hey there, love all your tips and tricks! I was wandering whether you could assist me with my iFrame problem? I am trying to develop a website that is hosted by IIS on a win2k3 server. I have one page which has an iFrame embedded which links to another website hosted elsewhere. The problem is, the iFrame/website I am trying to display requires authentication (login and Password). Is there any way to pass login credentials onto the other site via an iFrame? Any thoughts or ideas would be appreciated! Cheers
    Alan

  6. make frames html said,

    May 27, 2008 @ 7:05 am

    [...] ads.Trick 1: Page is built in frame on another site without your previous agreement. Remove thishttp://web3.0log.org/2006/11/23/2-useful-tricks-with-html-frames/Frames : Introduction - HTML TutorialEach of these windows can contain an html document. A file that [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment

It sounds like SK2 has recently been updated on this blog. But not fully configured. You MUST visit Spam Karma's admin page at least once before letting it filter your comments (chaos may ensue otherwise).