[英]How to increase the number of cards in website when data get from JSON using url in jQuery
[英]How to get the port number from the URL using jQuery?
這是URL:
http:// localhost:8888/index.html.
如何使用jQuery從此URL獲取端口號?
它在location
對象中可用:
location.port
請注意,如果URL中沒有端口,則location.port
將返回一個空字符串。
如果即使使用隱式默認端口也需要獲取端口,請嘗試:
var port = location.port || (location.protocol === 'https:' ? '443' : '80');
這足以滿足通過http
和https
協議提供的頁面的需求。
您不需要jQuery。
window.document.location.port
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.