Javascript 如何隐藏javascript window.open地址栏/位置栏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7170943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 01:09:40  来源:igfitidea点击:

How to hide javascript window.open address bar / location bar?

javascripthtml

提问by Gopipuli

How can I hide the location/address bar of popup window created using JS ? am attaching a image where I marked the place wanted to be hidden.

如何隐藏使用 JS 创建的弹出窗口的位置/地址栏?我附上了一张我标记了想要隐藏的地方的图片。

test

测试

Is it possible ? I use the below script for this.

是否可以 ?我为此使用以下脚本。

    var ctr=0;
    function openpopup(popurl){
    var winName = "New_"+(ctr++);
    winpops=window.open(popurl,winName,"height=300,width=500,top=300,left=500,scrollbars=yes,resizable")
    }

and used this to call onClick='openpopup(this.href);return false;'

并用它来调用 onClick='openpopup(this.href);return false;'

Please help me for the same.

请帮助我。

采纳答案by Allen Xia

Forget window.open(). Use jquery uior jquery tools overlayinstead. A js popup window will work.

忘记window.open()。改用jquery uijquery 工具覆盖。一个 js 弹出窗口将起作用。

回答by Mihai Iorga

You cannot hide the address bar in modern browsers. That is a security measure. The user must always know on what page he is. Also in that address bar is shown what type of page he is in (HTTP or HTTPS) and information of that webpage if it is secure.

您无法在现代浏览器中隐藏地址栏。那是一种安全措施。用户必须始终知道他在哪个页面上。同样在该地址栏中显示他所在的页面类型(HTTP 或 HTTPS)以及该网页的信息(如果它是安全的)。

So, sorry, but you cannot do that.

所以,对不起,但你不能那样做。

回答by Matt

you can use a modal dialog. Not exactly a pop up, but it will open another container. Like an overlay. You see people doing this a lot with images, but you can also use this for html. There are a ton of plugins for jquery.

您可以使用模态对话框。不完全是一个弹出窗口,但它会打开另一个容器。就像一个叠加。您会看到人们经常使用图像来执行此操作,但您也可以将其用于 html。jquery 有大量的插件。

Heres one with some examples though: http://jquery.com/demo/thickbox/

这里有一些例子:http: //jquery.com/demo/thickbox/

I personally like http://fancybox.net/

我个人喜欢http://fancybox.net/

Only problem is you can't use ajax to call another website, but you can create a page in php or whatever and get the contents of another page and then return that in ajax.

唯一的问题是你不能使用ajax调用另一个网站,但你可以用php或其他方式创建一个页面并获取另一个页面的内容,然后在ajax中返回。

you would want to use something like curl for this.

为此,您可能想要使用 curl 之类的东西。

回答by wesbos

You could have a generic page that has an embedded iframe to hide the actual page. Would be a little tricky to pass the right data though. Not really worth it imo.

您可以拥有一个具有嵌入式 iframe 的通用页面来隐藏实际页面。但是传递正确的数据会有点棘手。真的不值得imo。