我想拿个字符串
var a = "http://example.com/aa/bb/"
Run Code Online (Sandbox Code Playgroud)
并将其处理成一个对象
a.hostname == "example.com"
Run Code Online (Sandbox Code Playgroud)
和
a.pathname == "/aa/bb"
Run Code Online (Sandbox Code Playgroud) 我有URL http://somesubdomain.domain.com(子域名可能会有所不同,域名始终相同).需要使用子域名并使用greasemonkey(例如使用URL domain.com/some/path/here/somesubdomain打开一个新窗口,使用domain.com/some/path/here/somesubdomain)重新加载页面.