Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

c# - Open URL in NEW Microsoft Edge window

I'm writing an application (using C#) which needs to open provided URL in a NEW window of a specified web browser. The only browser I have problems with is Microsoft Edge.

Opening a page using browser exe doesn't work at all. Browser window does not even appear.

Process.Start("C:WindowsSystemAppsMicrosoft.MicrosoftEdge_8wekyb3d8bbweMicrosoftEdge.exe", "https://google.com");

I've searched over the internet and found another way:

Process.Start("microsoft-edge:https://google.com");

This code opens the page, but attaches it to an existing window, if any.

Is there a way to open the page in a NEW window?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am joining the line of desperate users of this program.

Here are my findings from today searching of such simple job (for normal browser).

  1. Bat file - no go Using direct call for microsoft-edge:"url" or calling for 3rd party utility is resulting all the same. Still working "nicely" but once you want more tha one site, it will add up another TAB.
    @echo

    EdgeLaunch.exe "http://www.idnes.cz"

    EdgeLaunch.exe "http://www.seznam.cz"

    exit

Sources: EdgeLaunch: http://www.edgemanage.emmet-gray.com/Articles/EdgeLaunch.html EdgeLauncher: https://github.com/MicrosoftEdge/edge-launcher

  1. Power shell script WARNING: as an research I am bypasing the security policy for the execution
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force;

    Start-Process -FilePath "msedge" -ArgumentList "http://idnes.cz"
    Start-Process -FilePath "msedge" -ArgumentList "http://novinky.cz"

FUN FACT: if you leave the URLs blank, it will open new-windows. Once you add valid url...again in tabs.

  1. HTML-Javascript - seriously?!!! - nearly working For all the shitty as it sounds. It is working nearly, but. Such popups are normally restricted. And even when I 20 times allowed pupus from local html file. Edge somehow ignores this eevery new startup. (omfg)

But, ok classic HTML structure, and a script on the page with:

 params  = 'width='+screen.width;
 params += ', height='+screen.height;
  params += ', top=0, left=0'
 params += ', fullscreen=yes';
 params += ', directories=yes';
 params += ', location=yes';
 params += ', menubar=yes';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=yes';
 params += ', show=yes';

window.open("http://idnes.cz",'window1', params);
window.open("http://novinky.cz",'window2', params);

Desperate fact: It opens the windows on a second manual attempt. But. Once you set "status=yes" attribute. It will again be the TAB.

Thats all I got from internet. Nobody with solution of simply opening 2 damned windows with some webpages.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...