The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> redirecting to input url?
olev_ait
post Nov 2 2006, 01:51 PM
Post #1





Group: Members
Posts: 5
Joined: 2-November 06
Member No.: 663



hello
what i want to do is have a form on my web page with text input so that if a user enters an url (http://address or just address) the page redirects to that url. i have tryed to search but i'm not quite sure what i should search for. if it's not possible with simple html i would prefer solutions for php and/or javascript.

thanks

ps. sorry for my bad enlish
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Nov 2 2006, 02:12 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Why? Most browsers provide a built-in mechanism for users to enter a URL and go to that URL. Users will already be familiar with that mechanism.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
olev_ait
post Nov 4 2006, 06:44 AM
Post #3





Group: Members
Posts: 5
Joined: 2-November 06
Member No.: 663



yes, but this leaves a lot more noticeable traces behind
i know lots of peaople who use this built-in mechanism as bookmarks (or favorites) and they dont want any crap addresses in there (a little silly but what can i do, they say that its a lot more handy for them)
and besides.. i have spent too much time searching for that solution to just give it up now
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Nov 8 2006, 08:00 AM
Post #4


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



You can use form for sending mail, delete what you don't need and use variable 'redirect'. You can find script here http://www.scriptarchive.com/readme/formmail.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 8 2006, 09:25 AM
Post #5


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(stjepan @ Nov 8 2006, 02:00 PM) *

You can use form for sending mail, delete what you don't need and use variable 'redirect'. You can find script here http://www.scriptarchive.com/readme/formmail.html


I wouldn't base anything on Matt's FormMail, it's lack of security has allowed it to be abused as a spam engine.

With the PHP header() function you might redirect users depending on the form data they submit. Note that this causes a privacy issue, since you can see which sites the user enter.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Nov 9 2006, 05:44 AM
Post #6


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



QUOTE
Matt's FormMail, it's lack of security has allowed it to be abused as a spam engine.

I didn't know that... sad.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Peter1968
post Nov 9 2006, 06:13 AM
Post #7


Serious Coder
*****

Group: Members
Posts: 448
Joined: 23-September 06
Member No.: 213



It's improved over the years, but FormMail still isn't up to scratch security-wise. Shame it's still so popular.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 9 2006, 09:09 AM
Post #8


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



There are drop-in replacements for Matt's scripts at http://nms-cgi.sourceforge.net/about.html AFAIK these are more secure.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
olev_ait
post Nov 9 2006, 05:47 PM
Post #9





Group: Members
Posts: 5
Joined: 2-November 06
Member No.: 663



thanks for all who answered... going to try the nms solution when i have some free time
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 9 2006, 06:16 PM
Post #10


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(Christian J @ Nov 8 2006, 03:25 PM) *

I wouldn't base anything on Matt's FormMail, it's lack of security has allowed it to be abused as a spam engine.

This is four years old, but still thought-worthy. Right after Nimda.
http://web.archive.org/web/20031203161108/...s_q1_2002.shtml
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
olev_ait
post Nov 11 2006, 09:33 AM
Post #11





Group: Members
Posts: 5
Joined: 2-November 06
Member No.: 663



<html>
<HEAD>
<script LANGUAGE="JavaScript">
function whatURL() {
window.location= 'http://' + document.form1.url.value;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name=form1>
<input type=text name="url">
<input type=button onClick="whatURL()" value="Go">
</FORM>
...

it works fine when i press the go button, but what should i do to make it work with pressing ENTER too?
tried several things but none working so far.. so i'm hopeing to get some explicit code from you, not just recommendations what to try.
thanks
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Nov 12 2006, 06:06 AM
Post #12


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



QUOTE
it works fine when i press the go button, but what should i do to make it work with pressing ENTER too?
tried several things but none working so far.. so i'm hopeing to get some explicit code from you, not just recommendations what to try.thanks

Example in details at http://www.cs.tut.fi/~jkorpela/forms/enter.html
Look for "Make ENTER submit"
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 12 2006, 08:19 AM
Post #13


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(olev_ait @ Nov 4 2006, 12:44 PM) *

yes, but this leaves a lot more noticeable traces behind
i know lots of peaople who use this built-in mechanism as bookmarks (or favorites) and they dont want any crap addresses in there (a little silly but what can i do, they say that its a lot more handy for them)


Using a form will not prevent the destination URL from being saved in the browser history.

Anyway you might experiment with the script below. It should work wether the user writes out "http://" or not, but does not work with other protocols like "ftp://". It does add a "?" after the destination URL but that shouldn't matter (and will not circumvent the auto-complete feature of the browser):

CODE
<form action="#" onsubmit="this.action='http://'+document.getElementById('url').value.replace('http://', '');">
<input type="text" id="url">
<input type="submit" value="go">
</form>
<noscript>Javascript is required to use the above form.</noscript>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
olev_ait
post Nov 12 2006, 06:41 PM
Post #14





Group: Members
Posts: 5
Joined: 2-November 06
Member No.: 663



thanks Christian... and everybody else...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd April 2024 - 07:22 AM