Last active
December 7, 2016 08:55
-
-
Save ccwq/dea1c5f93584483850759808430c2897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取当前页面的目录 | |
* "http://aa/b/s/b.html" //"http://aa/b/s/" | |
* "http://aa/b/s/b.html/#a/b/c" //"http://aa/b/s/" | |
* "http://aa/b/s/b.html/?asdf=p&a=s#a/b/c" //"http://aa/b/s/" | |
**/ | |
location.href.replace(/([^#?]+)\/.*?$/,"$1/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment