Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kzlambert

macrumors member
Original poster
Aug 11, 2006
50
0
UK
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
 
kzlambert said:
If anyone has a code that will make that possible I would greatly appreciate it..

Thanks

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="https://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
 
Thanks for that..I will have a go at implementing it...and then post if it works....thanks again :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.