简体   繁体   中英

Remove one word out of two same word from url

When I am filter data first its URL like be this type

"http://localhost/computers?specs=Category:intel!!0!!".

But when I am filtering second time its URL would be like this

"http://localhost/computers??specs=Category:intel!!0!!". 

So just I want to do that if I filter second time remove '??' (question mark) one out of two. Here is the code `

<script type="text/javascript">
        var currURL = window.location.href;

                String.prototype.endsWith = function (currURL) {
                    var d = this.length - currURL.length;
                    return d >= 0 && this.lastIndexOf(currURL) === d;
                };
</script>

`removing trailing '?' from url if any

Try with this

Url=url.replace("??",?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM