[HTML] [Javascrpt] How to get the current page URL (URL) and query parameters __mysql

Source: Internet
Author: User
How to get the current page URL (URL) and query parameters

Get the current page URL (URL) and query parameters in JavaScript.
Sometimes we need to get the URL parameters for the current page on the client, and you probably know that it's easier to get it on the server side, such as PHP or JSP, but it's simpler in JavaScript.
Let's take a look at the URLs shown below:

Http://www.webfans.org/index.php?query.
The previous section is the current URL for the page, http://www.webfans.org/, which we call query parameters.
To get the URL address of the current page just use the following code: < script language = ' JavaScript ' >
var Currenturl = this. Location.href
</script > Of course, the above method can also change the URL of a page to achieve the orientation of the page.
Get the query parameters, which are the following code. < SCRIPT language = ' JavaScript ' >
var currentquery = this. Location.search.
</script >

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.