有没有任何方法来获取没有查询字符串的URL? [英] Is there any method to get the URL without query string?

查看:132
本文介绍了有没有任何方法来获取没有查询字符串的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似的网址:http://localhost/dms/mduserSecurity/UIL/index.php?menu = true& submenu = true& pcode = 1235

我想获取没有查询字符串的URL: http://localhost/dms/mduserSecurity/UIL/index.php

I want to get the URL without the query string: http://localhost/dms/mduserSecurity/UIL/index.php.

JavaScript中有没有这方法?目前我使用 document.location.href ,但它返回完整的URL。

Is there any method for this in JavaScript? Currently I am using document.location.href, but it returns the complete URL.

推荐答案

试试这个: window.location.href.split('?')[0]

这篇关于有没有任何方法来获取没有查询字符串的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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