提问人:janak gera 提问时间:4/5/2017 更新时间:6/25/2022 访问量:1156
如何打开带有隐藏地址栏的 HTML 文件
how to open a html file with hidden address bar
问:
我需要通过调用下面编写的 javascript 函数打开我使用 C# 动态发送的 .html 文件
这是我用 C 语言写的#
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "fncpopup('" + sNewFileName + "');", true);
现在我在 Javascript 中调用一个函数
<script type="text/javascript">
//debugger;
function fncpopup(sFileName)
{
location.href = sFileName;
}
</script>
我想在 Location.href 中打开我的 .html 文件,并隐藏 URL 状态栏。我该怎么做。
答:
0赞
gurvinder372
4/5/2017
#1
我想使用 URL 状态栏在 Location.href 中打开我的.html文件 隐藏。我该怎么做。
用window.open
function fncpopup(sFileName)
{
window.open(sFileName, '_blank', 'toolbar=0,location=0,menubar=0');
}
在文档中查看更多选项
评论
0赞
janak gera
4/5/2017
Window.open 将在弹出窗口中显示我想在同一窗口上执行此操作,这就是我使用 Location.href 的原因
0赞
gurvinder372
4/5/2017
然后@janakgera删除第二个参数并将其保留为空_blank
0赞
janak gera
4/5/2017
通过这样做,我得到了创建html的父页面和使用新窗口打开.html的子页面。我需要在同一页面中打开它。因此,先生,我发现 Window.open 不是应用程序。
0赞
gurvinder372
4/5/2017
location.href 将在当前页面中打开 HTML。您无法以跨浏览器的方式使用 javascript 隐藏当前页面的地址栏。
评论
fncpopup