简体   繁体   中英

How to remove some text from url using Javascript / jQuery

i have web page with vertical slider when i am running slider it is changing URL. I want to remove some text on page refresh. Like i have a URL 95.0.4.12/inner/innerpage3.html and when i am using slider it is changing this URL to inner/innerpage3.html#slide4 or whatever slider number

<script type="text/javascript">
$(function (){
var top= window.top.location.href;
window.onload=$(document).scrollTop(0)
})
</script>

you can use document.location.hash try the following:

The hash property returns the anchor portion of a URL, including the hash sign (#).

$(function (){
    document.location.hash = ""
})

You can use window.location.hash to change the hash part of the URL. You can also use document.referrer to detect which slide the user came from.

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