最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - window.open() parameters not working in Edge - Stack Overflow

programmeradmin4浏览0评论

In Servicenow, I have a requirement to open a new window from a UI action. 1. Open in New window (not tab) 2. Display the navigation toolbar (buttons) 3. Display scrollbars 4. Be resizeable

Using var window = window.open(url, windowName, [windowFeatures]); appears to work fine in Chrome and Firefox, but in IE the window parameters are largely ignored. height and width seem to be the only ones that are adhered to. I am using Microsoft Edge 41.16299.248.0 and I cannot get a new window opened with the toolbar showing no matter what I try.

.asp?filename=tryjsref_win_open5 This is the test code:

myFunction() { window.open("", "_blank", "toolbar=yes,width=600,height=400,left=600,top=500,status=yes,scrollbars=no,resize=no");

}

When I click the button, a new window opens, no toolbar, not positioned according to left/top, no status bar, I DO see scroll bars, and I CAN resize.

Here is an example from MSDN: .85%29.aspx?f=255&MSPPError=-2147217396

According to MS, they've adopted " MDN Web Docs as the definitive place for useful, unbiased, browser-agnostic documentation for current and emerging standards-based web technologies. ", but I do not find any explanation of this issue I am experiencing.

Is this a known issue with IE Edge or is there some sort of workaround available?

In Servicenow, I have a requirement to open a new window from a UI action. 1. Open in New window (not tab) 2. Display the navigation toolbar (buttons) 3. Display scrollbars 4. Be resizeable

Using var window = window.open(url, windowName, [windowFeatures]); appears to work fine in Chrome and Firefox, but in IE the window parameters are largely ignored. height and width seem to be the only ones that are adhered to. I am using Microsoft Edge 41.16299.248.0 and I cannot get a new window opened with the toolbar showing no matter what I try.

https://www.w3schools./jsref/tryit.asp?filename=tryjsref_win_open5 This is the test code:

myFunction() { window.open("https://www.google./search?q=help", "_blank", "toolbar=yes,width=600,height=400,left=600,top=500,status=yes,scrollbars=no,resize=no");

}

When I click the button, a new window opens, no toolbar, not positioned according to left/top, no status bar, I DO see scroll bars, and I CAN resize.

Here is an example from MSDN: https://msdn.microsoft./en-us/library/windows/desktop/ms644696%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

According to MS, they've adopted " MDN Web Docs as the definitive place for useful, unbiased, browser-agnostic documentation for current and emerging standards-based web technologies. ", but I do not find any explanation of this issue I am experiencing. https://learn.microsoft./en-us/microsoft-edge/dev-guide

Is this a known issue with IE Edge or is there some sort of workaround available?

Share Improve this question asked Feb 16, 2018 at 4:18 Mohammad KadiwalMohammad Kadiwal 1011 silver badge4 bronze badges 3
  • What settings do you have in about:flags for localhost loopback; Do you have any extensions installed and enabled? Whatis servicenow? An intranet site? – Rob Parsons Commented Feb 19, 2018 at 2:03
  • Hi Rob, I don't see flags under settings. As I mentioned, I am using Microsoft Edge 41.16299.248.0, no extensions installed. I have also tried the "Open in Internet Explorer" option - which launched IE version 11.248.16299.0 with the same results. – Mohammad Kadiwal Commented Mar 4, 2018 at 5:29
  • about:flags is an internal tab.....which has settings for localhost loopback.... you 'open' it by typing about:flags in the Edge Address bar... other browsers have a similar page eg. chrome://flags. – Rob Parsons Commented Mar 8, 2018 at 1:32
Add a ment  | 

4 Answers 4

Reset to default 0

ServiceNow has made public that some features will no longer be supported on Microsoft Edge. Why don't you try with another browser like Mozilla or Chrome? It never fails those two to me. Opera might have some issues too, so I don't advise using that one.

Here's the link about the supported browsers: https://docs.servicenow./bundle/paris-release-notes/page/administer/navigation-and-ui/reference/browser-support.html

Hope this information helped :D Cheers!

Try using Glide Navigation API:

g_navigation.openPopup('incident_list.do?sysparm_query=active=true', 'Active Incidents', 'resizable,scrollbars,status', true);

try this

function win_open1() {
    window.open('about:blank','','titlebar=yes,toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=700,Height=300,left=0,top=0');
}

We encountered the same issues. It turned out that if the "location=" parameter is included, Edge pletely ignores all the parameters.

Removing that parameter allowed the others to work.

window.open (url, null,"height=200,width=200,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes");

Fails - window opens with same size as parent window.

window.open (url, null,"height=200,width=200,status=yes,toolbar=yes,menubar=yes,resizable=yes");

Works fine - window opens 200x200 pixels.

发布评论

评论列表(0)

  1. 暂无评论