HTML5 URL Input Box without Protocol
Asked Answered
B

2

10

When you use a input type of url instead of the standard text. Firefox 4 will not submit the form without http:// or https:// in the input box.

All I'm after is a URL without the protocol such as www.google.com not http://www.google.com. Is there a parameter to do this or any other way (preferably without JavaScript)?

Beason answered 3/5, 2011 at 20:8 Comment(0)
B
3

use the html5 novalidate attribute on the form, e.g.

<form method="post" novalidate>
   ...
</form>

this will give you the nice keyboard on mobile devices and let you do your own validation

https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-form-novalidate

Busey answered 21/12, 2012 at 21:13 Comment(0)
I
-1

I use RegExr for all my regular expression creation needs. They have a number of pre-defined regular expressions.

You might be able to reverse engineer this a little: (https?://)?(www\.)?([a-zA-Z0-9_%]*)\b\.[a-z]{2,4}(\.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(\.[a-z]*)?

Inductor answered 4/5, 2011 at 0:36 Comment(1)
Does not allow .museum and no IDN's.Rondarondeau

© 2022 - 2024 — McMap. All rights reserved.