Go Back   Dynamic Drive Forums > General Coding > JavaScript
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-14-2006, 03:23 PM
boxxertrumps's Avatar
boxxertrumps boxxertrumps is offline
Senior Coders
 
Join Date: Jun 2006
Location: Acton Ontario Canada.
Posts: 681
Thanks: 0
Thanked 1 Time in 1 Post
Question URL Bar Javascript

Hello, i need a script that has an input feild and the input is URL's. when a go button is clicked the url open in an inline frame. if you could write in a Back/Forward Script that'd be great.
PS. if it isnt conceivable please tell me.
Reply With Quote
  #2  
Old 06-14-2006, 04:19 PM
neomaximus2k neomaximus2k is offline
Junior Coders
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by boxxertrumps
Hello, i need a script that has an input feild and the input is URL's. when a go button is clicked the url open in an inline frame. if you could write in a Back/Forward Script that'd be great.
PS. if it isnt conceivable please tell me.
Its doable... at a rough guess (not tested this script)

HTML Code:
<input type="text" name="url" id="url">
<input type="button" onclick="showurl">
your iframe would be something like this

HTML Code:
<iframe name="theiframe" id="theiframe">
and the Javascript code would look like

Code:
function showurl(){
  if (document.getElementById('url').value != ""){
    theiframe.location = document.getElementById('url').value;
  } else {
    alert('No URL Entered');
  }
}
for the forward and back i think this will work
HTML Code:
<a href="Javascript:;" onclick"theiframe.history(-1);">
not tested any of that tho going off memory
Reply With Quote
  #3  
Old 06-14-2006, 05:54 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 19,005
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

Close but, with several errors, try:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Mini Browser</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function showurl(){
  if (document.getElementById('url').value != "")
    theiframe.location.href = document.getElementById('url').value;
  else
    alert('No URL Entered');
}
</script>
</head>
<body>
<input type="text" id="url"><br>
<input type="button" onclick="showurl();"><br>
<iframe name="theiframe"></iframe><br>
<a href="javascript:void(0);" onclick="history.go(-1);return false;">Back</a>&nbsp;<a href="javascript:void(0);" onclick="history.go(1);return false;">Forward</a>
</body>
</html>
Note: The back link will take you to the previous page in the history stack (if any) if there is nothing to go back to in the iframe. By launching the above page as a new window, that should eliminate that possibility.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #4  
Old 06-14-2006, 06:25 PM
shachi shachi is offline
Senior Coders
 
Join Date: Aug 2005
Posts: 971
Thanks: 0
Thanked 0 Times in 0 Posts
Question Searching for something like this??

Hey try this out: http://captninsano.tripod.com/browser.html

Recently Updated!!
(Works in FF 1.5 IE 5-6 but unfortunately not in Opera Has an extra feature{shows history when Ctrl is pressed})

If you are searching for something like that then I can provide you the code(freely distributable with appropriate credits). If you are not searching for something like that then it's not a problem at all.
Reply With Quote
  #5  
Old 06-14-2006, 07:13 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 19,005
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

Quote:
Originally Posted by shachi
Hey try this out: http://captninsano.tripod.com/browser.html

Recently Updated!!
(Works in FF 1.5 IE 5-6 but unfortunately not in Opera Has an extra feature{shows history when Ctrl is pressed})

If you are searching for something like that then I can provide you the code(freely distributable with appropriate credits). If you are not searching for something like that then it's not a problem at all.
The stop and refresh buttons can get you into trouble in FF and also cancel the history list feature in that browser. The page jumps from left to right when using the history and individual entries in the history reveal feature do not each have their own line.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #6  
Old 06-14-2006, 08:16 PM
shachi shachi is offline
Senior Coders
 
Join Date: Aug 2005
Posts: 971
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jscheuer1
The stop and refresh buttons can get you into trouble in FF and also cancel the history list feature in that browser. The page jumps from left to right when using the history and individual entries in the history reveal feature do not each have their own line.
The jumping page was made on purpose(so as to make it look like FF) and by the way I didn't get how can i get into trouble if I use the stop and refresh buttons?? And can you also tell me why "history reveal feature do not each have their own line" I would try to show it in a single line if it is not correct.
Reply With Quote
  #7  
Old 06-14-2006, 09:29 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 19,005
Thanks: 19
Thanked 1,135 Times in 1,121 Posts
Blog Entries: 3
Default

Quote:
Originally Posted by shachi
The jumping page was made on purpose(so as to make it look like FF) and by the way I didn't get how can i get into trouble if I use the stop and refresh buttons?? And can you also tell me why "history reveal feature do not each have their own line" I would try to show it in a single line if it is not correct.
The history lines could probably be fixed easily enough, if you are using an element's innerHTML to write them out, simply by inserting <br> tags after each entry after you append it. A nice touch would be to construct the list in such a way as to make each item a link to itself, with the target being the iframe.

I would think that Stop and Refresh should either be skipped or work as in a browser. If I hit Stop in the browser and then refresh, the page I was loading reloads and the history remains intact, neither of those happened.

These things could probably be achieved with (a) session cookie(s).

With the jumping history, to make it like FF (IE does this too) you could use an iframe or scrolling division (probably best) or frame to contain the history. This would make it more like those browsers are when their history buttons are clicked.

I realize that when designing something like this that there often is a tendency not to try and 'push the envelope' on the features when testing but, these thing will be done, as a matter of course, by individuals using the design.

Overall, I should mention that the design looked nice but, with its reliance on javascript and the fact that at best, it merely duplicates what the user has before them to begin with, I wonder about its usefulness. These reservations apply to this thread in general but, it is an interesting exercise.

I wonder why the OP wanted something like this to begin with.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
  #8  
Old 06-14-2006, 09:35 PM
boxxertrumps's Avatar
boxxertrumps boxxertrumps is offline
Senior Coders
 
Join Date: Jun 2006
Location: Acton Ontario Canada.
Posts: 681
Thanks: 0
Thanked 1 Time in 1 Post
Default thanks!

The Internet Does Care... and here's the finished product.
MY PAGE!
Reply With Quote
  #9  
Old 06-14-2006, 10:31 PM
neomaximus2k neomaximus2k is offline
Junior Coders
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by boxxertrumps
The Internet Does Care... and here's the finished product.
MY PAGE!
Nice glad the JS code worked,... well once it got the bugs taken out lol like i said was coded from memory and didnt have chance to check it over
Reply With Quote
  #10  
Old 06-15-2006, 07:56 AM
shachi shachi is offline
Senior Coders
 
Join Date: Aug 2005
Posts: 971
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jscheuer1
The history lines could probably be fixed easily enough, if you are using an element's innerHTML to write them out, simply by inserting <br> tags after each entry after you append it. A nice touch would be to construct the list in such a way as to make each item a link to itself, with the target being the iframe.

I would think that Stop and Refresh should either be skipped or work as in a browser. If I hit Stop in the browser and then refresh, the page I was loading reloads and the history remains intact, neither of those happened.

These things could probably be achieved with (a) session cookie(s).

With the jumping history, to make it like FF (IE does this too) you could use an iframe or scrolling division (probably best) or frame to contain the history. This would make it more like those browsers are when their history buttons are clicked.

I realize that when designing something like this that there often is a tendency not to try and 'push the envelope' on the features when testing but, these thing will be done, as a matter of course, by individuals using the design.

Overall, I should mention that the design looked nice but, with its reliance on javascript and the fact that at best, it merely duplicates what the user has before them to begin with, I wonder about its usefulness. These reservations apply to this thread in general but, it is an interesting exercise.

I wonder why the OP wanted something like this to begin with.
It was just made as an experiment(you know it as you helped me making it) not in a way to give some facilities to people(because I knew that people would already have a browser to see one like that). And I still don't know how to make cookies(as I am just a beginner). But anyways if you wish then you can make some changes in it too.

If you wish
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:42 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.