解析URL，From http://bbs.html5cn.org/thread-436-1-25.html