Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML5输入安全ssl_Html_Ssl_Input - Fatal编程技术网

HTML5输入安全ssl

HTML5输入安全ssl,html,ssl,input,Html,Ssl,Input,我有一个输入标签,如: <input type="url" id="inputWebsite" name="url"> 我需要确保用户输入的值包含一个安全的url,如https:// 我该怎么做?您可以在html5 url标记中使用模式: <input type="url" pattern="https?://.+" required /> 例如,将上述表达式与 http://www.ics.uci.edu/pub/ietf/uri/#Related 导致以

我有一个输入标签,如:

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

我需要确保用户输入的值包含一个安全的url,如https://
我该怎么做?

您可以在html5 url标记中使用模式:

<input type="url" pattern="https?://.+" required />
例如,将上述表达式与

  http://www.ics.uci.edu/pub/ietf/uri/#Related
导致以下子表达式匹配:

  $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
$1=http:
$2=http
$3=//www.ics.uci.edu
$4=www.ics.uci.edu
$5=/pub/ietf/uri/
$6 = 
$7 = 
8美元=相关
$9=相关

您可以尝试使用以下方法:

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

你把代码放在哪里?在标签里面还是标签里面?
<input type="url" name="website" id="inputWebsite" required pattern="https://.+">