/    Sign up×
Community /Pin to ProfileBookmark

javascript mini browser

I want to make a mini javascript browser, all i want it to do is when someone types a url in the box, it will load a iframe with the page on. How do i do that? ?

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JOct 08.2006 — Take a look at this example to see if it is something like what you are after


www.huntingground.freeserve.co.uk/webplus/iframes/iframe_popup.htm
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — no, i want a input box and a iframe. When someone types a url in the input box, the url is loaded in the iframe, can this be done in serverside javascript?
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — if you ned help trying to figure out what i mean, here is my
[code=html]
<form id="mini_browser">
<input type="text" id="urlbox" value="Url here!" />
</form>
<iframe id="urlpage" src="home.html">You need a new browser to use the mini browser, so <a href="http://********firefox.com/">Get Firefox!</a></iframe>[/code]
Copy linkTweet thisAlerts:
@Mr_JOct 08.2006 — Try this

[code=php]<script type="text/javascript">

function loadIframe(){
window.frames["urlpage"].location=document.forms["mini_browser"]["urlbox"].value
}

</script>

<form name="mini_browser">
<input type="text" name="urlbox" value="Url here!" />
<input type="button" value="Load Page" onclick="loadIframe()">
</form>
<iframe name="urlpage" src="home.html">You need a new browser to use the mini browser, so <a href="http://********firefox.com/">Get Firefox!</a></iframe>
[/code]
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — sort of there but when i type a url, press load page it loads: [drive+folder+url]

Ive tried editing the code but nothing.
Copy linkTweet thisAlerts:
@Mr_JOct 08.2006 — What have you typed in the input box?
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — ive figured it out now - but how do you made it work for google.co.uk
Copy linkTweet thisAlerts:
@Mr_JOct 08.2006 — If you are only typing in such as google.co.uk

Change this line

window.frames["urlpage"].location=document.forms["mini_browser"]["urlbox"].value

to

window.frames["urlpage"].location="http://www"+document.forms["mini_browser"]["urlbox"].value

See how that goes
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — yeah, i just changed that, but the problem is, if someone types http:// or www. or whatever it will fail
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — ive just figured it, use a dropdown list so they wont get confused! thanks
Copy linkTweet thisAlerts:
@Mr_JOct 08.2006 — Ok but you might as well give this a try

[code=php]
<script type="text/javascript">

function loadIframe(){

url=document.forms["mini_browser"]["urlbox"].value

re=/http:///
url=url.replace(re,"")
url=url.replace("www.","")

window.frames["urlpage"].location="http://www."+url

}

</script>

<form name="mini_browser">
<input type="text" name="urlbox" value="Url here!" />
<input type="button" value="Load Page" onclick="loadIframe()">
</form>
<iframe name="urlpage" src="home.html">You need a new browser to use the mini browser, so <a href="http://********firefox.com/">Get Firefox!</a></iframe> [/code]
Copy linkTweet thisAlerts:
@cwaldenauthorOct 08.2006 — thanks
×

Success!

Help @cwalden spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...