Of course, we can get the parameter value in the background, and then get the variable value in the front-end js Code. For details, refer to my article: javaScript obtains the C # variable in the background and calls the background method.
In
The path to obtain the previous page address is often encountered. You can return to the previous page for use to implement this operation through JS. The following is a good example. you can refer to the actual project process, we often encounter
1. Encode the parameters passed by the URL
Using a URL to pass parameter data is to add the appropriate parameters after the URL address. These parameters are processed by the URL entity. It is used in the following format:
It is obvious that this
Search Baidu link?ulr= Real link form
/*
Getrealurl get 301, 302 redirect URL by enenba.com
@param str $url Query
$return the true URL of str-directed URL
*/
function Getrealurl ($url) {
The path to obtain the previous page address is often encountered. You can return to the previous page for use to implement this operation through JS. The following is a good example. you can refer to the actual project process, we often encounter
Function
Getquerystring (querystringname)
{ VaR Returnvalue = "" ; VaR Urlstring = New String (document. Location ); VaR Serachlocation =- 1 ; VaR Querystringlength = Querystringname. length; Do {Serachlocation =
"Http: //" is the protocol name.
"Http://www.luohx.com/" is a domain name
"AAA" is the site name
"BBB. aspx" is the page name (file name)
"Id = 5 & name = Kelli" is a parameter
[1] obtain the complete URL (protocol name + domain name + site
1. When you change the URL parameter in the address bar, the system prompts that you are not authorized to perform this operation.
Set the following
CodeIn the page_load event
Try
{
String strtemp = request. urlreferrer. pathandquery;
}
Catch
From Network
--------------------------------------------------
// Capture querystring, this sentenceCodeYou can also put it in the getpara function.VaR urlpara = location. search;// Analysis parametersFunction getpara (paraname){VaR Reg = new
It is not difficult to obtain URL parameter information through JavaScript, and there are many methods. The reason for using this method is that it uses regular expressions and is very concise.
FunctionGetquery (name)
{
VaRReg =NewRegexp
This article shows how to send parameters along with the URL in an http post.
Consider that a Web server needs some parameters for e.g.
// Url for post request._ Lit8 (kposturi, "http://mysite.net/test/update ");
The following parameters
Automatically jumps back to the pre-Logon page after Logon
Principle:ExploitationReferer + URLParameter implementation
1:User not logged on,Try to download(You need to log on before downloading),ClickDownloadHour,The request will
Window. Location. href = "index. aspx"; the current page is displayed.Window. Open ("index. aspx") open a new page URL parameter resourceedit. aspx? Ismanager = 1 & id = 2 Obtain the URL parameter request ("ismanager") = 1 function request
Why do we need to encode parameters? I believe that the majority of programmers who have experience in development know that in the Web, if the parameter value is directly transferred on the Url address, if it is Chinese, or +, there will be garbled
Before modification:Copy codeThe Code is as follows: After modification:Copy codeThe Code is as follows: Thanks to the grass-roots programmers for rewriting this method. It is more rigorous and efficient. I will study it later !!!Copy codeThe Code
In order to do this, in addition to jquery library and idTabs plug-ins, we also need to download a plug-in used to engage in URL: jquery. url. js, portal: https://github.com/allmarkedup/jQuery-URL-Parser(The above link may be incorrect. If it cannot
Method 1: Take the link as a string, break it down according to the link format, and then obtain the corresponding parameter value.Method 2: use regular expressions for direct matching.Keyword: parameter: location. href, url, Link, javascriptMethod 1
Currently, webpage processing often involves processing address bar parameters, but it has always been done by feeling, and I don't know where to change it. Therefore, I made a special method to modify the parameters in the address bar, so I don't
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.