Validate site/domain via javascript

Posted by Chez on Stack Overflow See other posts from Stack Overflow or by Chez
Published on 2010-04-21T11:16:22Z Indexed on 2010/05/07 16:48 UTC
Read the original article Hit count: 227

I have a standard html form where the user can specify a website/domain:

favourite website: [ ]

I expect the user to type things like:

[www.google.com] [www.yahoo.com] [www.example.co.jp]

I want to validate the domain/site via javascript so if a user had typed something wrong:

[www...google.com] [www.-example.com]

I tell them straight away.

Can anybody post this javascript ?

Alternatively can anybody point me to a site where I can look at their javascript ?

Many Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about input-validation