jQuery删除URL的一部分 [英] jquery remove part of url

查看:145
本文介绍了jQuery删除URL的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我说我有以下网址;

Lets say i've got the following url;

http://www.domain.com/en-US/assortment/en-US/category/page.aspx?sub=GROUP7

如您所见,URL中有两个语言层,我只想从中删除第二个语言层.因此,我希望该网址是这样的.

As you can see I have two language layers in the url from which I want to remove ONLY the second one. So I expect the url to be like this.

http://www.domain.com/en-US/assortment/category/page.aspx?sub=GROUP7

由于技术限制,我没有其他修改网址的方法.可以使用jQuery或Javascript实现吗?如果是,怎么办?

Due to technical limitations I don't have any other ways to modify the url. Can this be achieved with jQuery or Javascript? If yes, how?

推荐答案

'your url here...'.replace( '/assortment/en-US/category/', '/assortment/category/');

这篇关于jQuery删除URL的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆