我需要解析一个网址:
http://localhost.com/kw-webapp/preview/cn/1/cmm/Default/13203/content.13203.1.1.html?context=
var url = window.location.pathname.split( '/' );
var _language = 4;
var _layoutuid = 5;
var _themeuid = 6;
var _contentuid = 7;
var _content = 8;
var language = url[_language];
var layoutuid = url[_layoutuid];
var themeuid = url[_themeuid];
var contentuid = url[_contentuid];
var content = url[_content];
但我需要从这个位置解析 url:
cn/1/cmm/Default/13203/content.13203.1.1.html?context=
变量必须是:
var _language = 0; //1
var _layoutuid = 1; //cmm
var _themeuid = 2; //Default
var _contentuid = 3; //13203
var _content = 4;
我的问题是,url 可以这样开始:
www.localhost.com/kw-webapp/kw/preview/cn/1/cmm/Default/13203/content.13203.1.1.html?context=
或这个:
www.localhost.com/preview/cn/1/cmm/Default/13203/content.13203.1.1.html?context=
如何解析来自 cn/1/cmm/Default/13203/content.13203.1.1.html?context= 的 url?