In Page Browser

Discussion in 'Web Design and Development' started by kzlambert, Sep 7, 2006.

  1. kzlambert macrumors member

    kzlambert

    Joined:
    Aug 11, 2006
    Location:
    UK
    #1
    Hi there... I am looking for a code that will allow me to create a "browser" within a webpage. To explain that better I will simulate what I mean..


    [ A box where you type in a web address ] [ Go Button ]


    [ An inline frame where the page will load after 'Go' is pressed ]



    If anyone has a code that will make that possible I would greatly appreciate it..

    Thanks
     
  2. weg macrumors 6502a

    weg

    Joined:
    Mar 29, 2004
    Location:
    nj
    #2
    You need two files, I'll call the first one main.html:

    <html>
    <head>
    <title>Browser</title>
    </head>
    <frameset rows="10%,90%">
    <frame src="browse.html" name="top">
    <frame src="http://www.macrumors.com" name="bottom">
    </frameset>
    <noframes>
    <body>
    No Go
    </body>
    </noframes>
    </html>

    The second one is called browse.html:

    <html>
    <head>
    <title>Browse</title>
    <script type="text/javascript">
    function goto ()
    {
    parent["bottom"].location.href = document.address_form.address.value;
    }
    </script>
    </head>
    <body>
    <form name="address_form">
    Address: <input type="text" size="40" name="address">
    <input type="submit" value="Go!" onclick="return goto();">
    </form>
    </body>
    </html>

    I have only tested this with Mozilla, in theory it should work with other browsers, too. However, know that you know how it works in principal, it should be easy for you to change it to your needs..

    PS: Seems that MacRumors doesn't show my indentation, so it's a bit messy.. your editor of choice will fix that
     
  3. kzlambert thread starter macrumors member

    kzlambert

    Joined:
    Aug 11, 2006
    Location:
    UK
    #3
    Thanks for that..I will have a go at implementing it...and then post if it works....thanks again :)
     

Share This Page