简体   繁体   中英

Open a web browser popup in command line

Is there a way to open a web browser popup in command line on Windows 7 ?

I need to pass it some arguments :

  • Popup width and height
  • Popup url to open when launched
  • Position X and 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 :

<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

"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. Then it navigates to the URL specified in the window.location instruction.

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.

Hope it helps someone !

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