3

I have a HTA application. Within the HTA, I'm calling a function to open up a webpage using:

window.open( sURL, "Working" );

This opens a page in Internet Explorer and not Edge.

Is there a way to default window.open to open a webpage in Edge?

user692942
  • 16,398
  • 7
  • 76
  • 175
Demetrius
  • 39
  • 4
  • 2
    HTAs do not open in Internet Explorer. They are opened by MSHTA.exe (Microsoft (R) HTML Application host) and rendered by MSHTML.dll. HTAs must always be associated to MSHTA.exe. Why are you trying to change it? – LesFerch Apr 16 '22 at 02:57
  • Sorry. You are correct. I wasn't very clear. My apologies. Within the HTA, I'm calling a function to open up a webpage using: window.open( sURL, "Working" ); This opens a page in Internet Explorer and not Edge. Hope that is more clear. – Demetrius Apr 17 '22 at 03:19
  • Does this answer your question? [Open programs from HTA application](https://stackoverflow.com/a/58271074) – user692942 Apr 17 '22 at 20:17

1 Answers1

3

Using window.open in an HTA will always open the specified URL in Internet Explorer, even in Windows 11 (build 22000.348 or higher required). If you wish to open a web page in Edge, you can do so using the Run method:

Set oWSH = CreateObject("WScript.Shell")
oWSH.Run "msedge.exe --new-window ""https://www.cnn.com""",0,False
LesFerch
  • 1,540
  • 2
  • 5
  • 21