如何删除地址栏中页面的URL?

问题描述 投票:1回答:1

所以每当我点击href时,会出现一个弹出页面,它将出现add_form.php,并且里面有一个表单。

这是我的代码:

<a href="" onclick='return popup_link()'>Add</a>

<script type='text/javascript'>
        function popup_link(){
        var url = 'add_form.php'; 
        window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1076,height=768,directories=no,location=no'); 
        }
</script>

我只是想知道,每次单击<href>链接时,如何删除地址栏中当前页面的URL,其中输出为输出。

http://127.0.0.1/no%20page%20reload/add_form.php

上面的URL指向localhost。我不想在该弹出页面上看到该URL。因此,每次打印当前页面时,打印页面上都不包含或显示URL。

javascript php jquery html css
1个回答
1
投票

要修改当前URL,您可以使用:

1.The pushState()如果要将新修改的URL添加到历史记录条目。

2.The replaceState() method如果要更新/替换当前历史记录条目

window.history.pushState({}, document.title, "/" + NewURL );
© www.soinside.com 2019 - 2024. All rights reserved.