簡體   English   中英

HTML5輸入安全ssl

[英]HTML5 input secure ssl

我有一個輸入標簽,如:

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

我需要確保用戶輸入的值包含一個安全的URL,如https://我該怎么做?

你可以嘗試使用這個:

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

你可以在html5 url標簽中使用pattern:

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

在papper統一資源標識符(URI):通用語法[RFC3986] http://www.ietf.org/rfc/rfc3986.txt中 ,URI的正則表達式是:

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

例如,將上面的表達式與之匹配

  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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM