Get path and Web application get path method in Java file1. Understanding of Basic Concepts' Absolute path ': The real path on the hard disk where you apply the file or directory, such as: URL, physical pathFor example:C:/xyz/test.txt represents the
Original address: Http://my.oschina.net/xianggao/blog/85172?fromerr=WnWLB6aV1. Understanding of Basic Concepts' Absolute path ': The real path on the hard disk where you apply the file or directory, such as: URL, physical pathFor example:C:/xyz/test.
1, get the current JS file path in jquery
In jquery to get the current JS file path is relatively simple, only need the following line of code to be done.
var __file__ = $ ("script"). Last (). attr ("src");
Note that we typically place this line
The _ FILE _ constant like PHP does not exist in javascript files for us to obtain the path of the current FILE. After research, we can use the following methods:
1. Get the current JS file path in jQuery
It is relatively simple to obtain the path
(1), Request.getrealpath ("/");//not recommended to get the root path of the project(2), Request.getrealpath (Request.getrequesturi ());//Get the path of the JSP, this method is more useful, can be used directly in the servlet and JSP(3),
Gets the path to the current JavaScript script fileGets the path to the current JavaScript script file, which may be required under a specific scenario, such as writing a module loader or logging. There is no uniform method for all browsers, this
Obtain the path of the current Javascript script fileObtain the path of the current Javascript script file
Obtain the path of the current Javascript script file, which may be required in specific scenarios, such as writing module loaders or logging.
This article mainly introduces the JavaScript uses a tag to obtain the current directory absolute path method, this article explains the method to be quite special, needs the friend to be possible to refer to under
When it comes to path-related
When it comes to path-related issues, everyone will go to the window.location and think that this object provides quite a lot of path information, which is commonly used to include:
Location.href: Full URL of the current pageLocation.pathname: path
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.