简体   繁体   English

在命令行中打开Web浏览器弹出窗口

[英]Open a web browser popup in command line

Is there a way to open a web browser popup in command line on Windows 7 ? 有没有办法在Windows 7的命令行中打开Web浏览器弹出窗口?

I need to pass it some arguments : 我需要传递一些参数:

  • Popup width and height 弹出框的宽度和高度
  • Popup url to open when launched 弹出网址在启动时打开
  • Position X and Y 位置X和Y
  • Display no address bar 不显示地址栏

I ended up finding the solution myself. 我最终自己找到了解决方案。 It was in fact really simple, here it is : 这实际上非常简单,这里是:

Solution

Create a new html file (in this exemple it will be created under c:\\openPopup.html ), containing a simple script tag : 创建一个新的html文件(在此示例中,它将在c:\\ openPopup.html下创建),其中包含一个简单的脚本标记:

<script>
    window.resizeTo(with,height);
    window.moveTo(x,y); // (0,0) is the top-left corner of the screen
    window.location('http://url-you-want-to-open-as-popup/');
</script>

Open a new cmd , then type 打开一个新的cmd ,然后键入

"C:\Program Files\Internet Explorer\iexplore.exe" c:\openPopup.html

Explanations 说明

We're using a proxy to open a popup. 我们正在使用代理打开弹出窗口。 We're launching our proxy ( openPopup.html ) which contains the instructions to transform the window in popup. 我们正在启动代理( openPopup.html ),其中包含在弹出窗口中转换窗口的说明。 Then it navigates to the URL specified in the window.location instruction. 然后,它导航到window.location指令中指定的URL。

I haven't found a way to hide the address bar yet but it wasn't mandatory. 我还没有找到隐藏地址栏的方法,但这不是强制性的。 A nice feature would be to pass the url as an argument. 一个不错的功能是将url作为参数传递。

Hope it helps someone ! 希望它能对某人有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM