window.open API returns null although the window is launched.

himanshu nandu 1 Reputation point
2022-09-06T16:05:51.597+00:00

I am trying to to open a window using window.open as shown below

var dlg = window.open("blank.html", name, args);

here although the window is open, the return value dlg is null.

blank.html contains only one line of code to set bgcolor in the body.

other arguments are name = "searchDlg_1661780304926"
args = "width=870, height=925, top=20, left=70, toolbar=0, scrollbars=0, resizable=1, status=0"

we have opened the browser using IWebBrowser2 interface (IID_IWebBrowser2)and navigate the URL with Navigate2 API. this browser is embedded inside a Cwnd.

we saw this returning null at some customer work stations and but same API works fine in our local environment. we found both systems to be on latest windows update.

Also if instead of giving "blank.html" if we specify the jsp page itself then window.open does not return null and works fine.

var dlg = window.open(search.jsp, name, args);

Urgent Help is appreciated as lot of customers are blocked.

Microsoft Edge Microsoft Edge development
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.