www.webdeveloper.com
Results 1 to 5 of 5

Thread: IFrame

  1. #1
    Join Date
    Mar 2008
    Posts
    57

    IFrame

    Hello all, I have 2 questions related to IFrame element:

    <iframe src="?????" allowtransparency="true" name="myframe" width="633" height="476" frameborder="0"></iframe>

    1. allowtransparency="true" works only for Mozilla, how can I get transparent iframe in IE, Opera, etc..?
    2. what should be instead of ????? in src="?????" if I want to keep the same page after refresh? In other words when I refresh, the page becomes blank.

    Thanks a lot

  2. #2
    Join Date
    Apr 2006
    Posts
    493
    taken from another webforum

    I found it..

    The solution is this:

    1. First Give your iframe the allowtransparency="true" tag.
    2. Make sure the source page's content has NO background color specified... not in the page itself, and not in any stylesheet linked to the page! This will make the body color pure white.
    3. Add this to your iframe tag:
    style=filter: chroma(color="#FFFFFF");

    Step 1 and 2 makes the iframe transparent in netscape/mozilla/firefox. As long as the page has no other background specified, the transparency works... but if you specify a background color, the transparency is lost.

    Step 3 makes it work in Internet explorer, ie's filter:chroma nukes the white background. That means you must make sure no other part of your page (or at least nothing in that iframe) has pure white, or it will be made invisible. That's pretty easy, if something is even slightly differently colored (for example #FFFFFD) then it won't be transparent.

    So the example code:

    <iframe src="anything.htm" frameborder="No" style="FILTER: chroma(color=#FFFFFF)" allowtransparency="true">
    </iframe>

    And "anything.htm" must not have any bgcolor specified in its body tag, or in a style section, or in any CSS that it's linked to.

    Hope this was helpful to someone other than me.
    as far as the iframe src=

    that src is the link to the page you are referencing eg, src="http://www.google.com" or http:www.yourwebsite.com/filename.html"

  3. #3
    Join Date
    Mar 2008
    Posts
    57
    Thank you sooo much it worked, you are the best
    Sorry but perhaps you could know the solution to my second question, that is when I refresh the page, current page becomes blank.

    <iframe src="javascript:updateFrame()" frameborder="No" style="FILTER: chroma(color=#FFFFFF)" allowtransparency="true" name="myframe" width="633" height="476" ></iframe>

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    Don't know if this is any help, but here is a small page on iFrame navigation menus, or how to make a mini-browser using an iFrame...

    http://www.createbutton.com/iframe.html

    For refresh, they have an absolute URL, but you can probably use the same javascript they used in the address field to display a static page or the most recently entered page.

    Hope this helps.

  5. #5
    Join Date
    Apr 2006
    Posts
    493
    i have used a refresh in this instance

    Code:
    <script type=text/javascript>
    // The time out value is set to be 10,000 milli-seconds (or 10 seconds)
    setTimeout(' document.location=document.location' ,10000);
    </script>
    i used that code on the page that is being used in the iframe, not on the parent document. 10 seconds is far too fast in your case, but you can edit that, the code is to be placed in your <head>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles