In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
First, obtain the parameters through _ window.location
1. Get the complete url of the page
Url = _ window.location.href
2. Get the domain name of the page
Host = _ window.location.host
Host2=document.domain
Application scenario: the page jumps, and the domain names of the development environment and the test environment are different, so you need to dynamically obtain the url that is stitched and redirected.
2. Javascript regularly acquires the parameters in url. 1. Obtain parameters through substr and split.
/ / canonically get the parameter function URL_Request (strName) {var strHref = _ document.location.toString () in url; var intPos = strHref.indexOf ("?"); var strRight = strHref.substr (intPos + 1); / / = get the parameter part on the right var arrTmp = strRight.split ("&"); / / = split into an array for (var I = 0; I < arrTmp.length) by Circular array {var dIntPos = arrTmp [I] .indexOf ("="); var paraName = arrTmp [I] .substr (0, dIntPos); var paraData = arrTmp [I] .substr (dIntPos + 1); if (paraName.toUpperCase () = = strName.toUpperCase ()) {return paraData;}} return ";}
Use:
Var pbtradeId=URL_Request ("tradeId"); 2. Get [update20170503] through split
Function getQueryString (str, key) {if (str) {var queryString = str.split ('?) [1] | |'; var arr = queryString.split ('&') | | []; for (var I = 0; I)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.