简体   繁体   English

HTML5输入安全ssl

[英]HTML5 input secure ssl

I have an input tag like: 我有一个输入标签,如:

<input type="url" id="inputWebsite" name="url">

I need to ensure that the value the user enters contains a secure url like https:// How can I do it ? 我需要确保用户输入的值包含一个安全的URL,如https://我该怎么做?

你可以尝试使用这个:

<input type="url" name="website" id="inputWebsite" required pattern="https://.+">

You can use pattern in html5 url tag: 你可以在html5 url标签中使用pattern:

<input type="url" pattern="https?://.+" required />

In the papper Uniform Resource Identifier (URI): Generic Syntax [RFC3986] http://www.ietf.org/rfc/rfc3986.txt the regular expression for a URI is: 在papper统一资源标识符(URI):通用语法[RFC3986] http://www.ietf.org/rfc/rfc3986.txt中 ,URI的正则表达式是:

^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

For example, matching the above expression to 例如,将上面的表达式与之匹配

  http://www.ics.uci.edu/pub/ietf/uri/#Related

results in the following subexpression matches: 导致以下子表达式匹配:

  $1 = http:
  $2 = http
  $3 = //www.ics.uci.edu
  $4 = www.ics.uci.edu
  $5 = /pub/ietf/uri/
  $6 = <undefined>
  $7 = <undefined>
  $8 = #Related
  $9 = Related

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM