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.com/jsref/tryit.asp?filename=tryjsref_win_open5
This is the test code:
myFunction() { window.open("https://www.google.com/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.com/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.com/en-us/microsoft-edge/dev-guide
Is this a known issue with IE Edge or is there some sort of workaround available?
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.com/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 completely 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.
Related
I have the latest Version of Chrome Version 86.0.4240.111 in 2020.
When I run a Window.Open command in Typescript Angular, its not honoring the toolbars. I need the back/forth navigation buttons. How can I make Chrome follow this?
const strWindowFeatures = `location=yes,height=${screen.height},width=${screen.width},fullscreen=yes,toolbar=yes,scrollbars=yes,resizable=yes`;
var newWindow = window.open('http://www.cnn.com', 'test', strWindowFeatures);
newWindow.moveTo(0, 0);
No Back and forth arrows above
According to MDN window.open#Toolbar_and_UI_parts_features:
In modern browsers (Firefox 76 or newer, Google Chrome, Safari, Chromium Edge), the following features are just a condition for whether to open popup or not. See popup condition section.
And according to popup condition:
Most modern browsers (listed below) don't allow web content to control the visibility of UI parts separately.
Firefox 76 or newer
Google Chrome
Safari
Chromium Edge
UI-related items of windowFeatures are used as a condition to whether opening a popup or a new tab, or a new window, and UI parts visibility of each of them is fixed.
The condition is implementation-depepdent and not guaranteed to be stable.
So, what I guess is that you are opening a popup and, for this reason, Google Chrome does not allow showing other chrome's elements out of the navigation bar. This probably to distinguish a popup from a new tab.
Passing these options to window.open will make a popup being created instead of a normal tab, but it seems some of them are not really used if not for the reason above.
menubar
toolbar
location
status
resizable
scrollbars
Hope this will be useful to you.
I am writing a web application and I open some popup windows with respect to user events.
Now I want to avoid from having too many opened popups, so I decided to bring already opened popup front instead of pop a new one.
In my researches I saw that there was a method called window.focus in old browsers like before Chrome 20 or so, but this method is no longer available because of over usage for advertisement.
Is there any solid way or even workaround to bring an already opened up popup front in javascript?
Thanks,
Ugurcan
I came up with a workaround for Chrome. In javascript, when you use window.alert method, Chrome brings according window to the front, but this is not applicible for Firefox and IE.
I will use this workaround for now. Only problem here is that, one does not simply decorate window.alert pop-up box.
We can just use css z-index to bring it at front and z-index is supported in effectively all browsers (since IE6+, Firefox 2+, Chrome 1+ etc) as per caniuse.com
I am currently using Mozilla Firefox 30.0 and it seems that it doesn't support window.close() anymore.
You may refer on the image below or if it is too small for you, here is the
link.
I opened the website of Google using window.open and then I tried to close it using window.close() but it says undefined.
Is there any other option that I can using to close the window using javascript on firefox?
The Firebug console unfortunately does not display the warning that goes along with it, which reads (in the regular Firefox Web Console}:
Scripts may not close windows that were not opened by script.
Also MDN window.close states:
This method is only allowed to be called for windows that were opened by a script using the window.open method.
So, you aren't allowed to call window.close() on windows that were explicitly opened by the user.
PS: This isn't new behavior, but around for ages (even before Firefox was called Firefox).
PS: To give an example, you are allowed to do something like this, only, i.e. close a window returned from window.open:
var w = window.open("http://google.com");
setTimeout(function() { w.close(); }, 1000);
Im trying to open new window from parent window when user choose to print the parent window ,i re-draw the parent page in the new page by using :
document.getElementById('demo_tab_info').innerHTML=window.opener.document.getElementById('demo_tab_info').innerHTML;
and then i control the element by javascript(hide some and show some of them).
That work fine with Firefox and Chrome ,but it is not with IE,does there an explanation for this?
also
window.print();
Does not work with Chrome? Can any one help with these two problems?
As for second question.
Function:
window.print()
is supported in all major browser (source: http://www.w3schools.com/jsref/met_win_print.asp)
But it is true that it is not standardized function by W3C (https://developer.mozilla.org/en/DOM:window.print).
The following javascript opens a pop-up in Firefox, Safari, IE, and Google Chrome:
window.open("http://google.com", "foo", "toolbar=yes,location=yes,menubar=yes")
However, in Google Chrome the toolbar (with the usual forward and back buttons, etc.) does not appear on the popped-up window. (Tested on both Windows and Mac.)
How can I fix this? I would like the user to be able to navigate forward and back using the tools with which they are most familiar.
There is a bug open for Chrome:
https://code.google.com/p/chromium/issues/detail?id=82522
It has not received a lot of attention from Google. Vote for it.
Unfortunately Chrome only supports a small set of window features when using window.open. If you believe that this is a bug or an issue you can file it at [http://crbug.com].
If you just use window.open(url) then it will open a new tab in the same window with the buttons you desire.
Updating on current behavior (as of 4/26/2017)
The expected behavior should be a new PopUp Window when size dimensions are passed as arguments to window.open (if toolbar is enabled, then add the toolbar to the PopUp window). If no dimensions are indicated just default to opening a new tab (in this case toolbar enabled is the default).
(Btw, this is FF current Behavior (version 54.0a2)) .
Chrome Behavior (Canary 60.0.3079.0)
Opens PopUp Window to indicated dimensions
window.open("https://google.com","foo","width=800, height=780")
Opens New Tab (browsers default minimized size, ignores size dimensions)
window.open("https://google.com","foo","width=800, height=780,toolbar=1")
FF Behavior
w/Size Dimensions
Opens PopUp Window w/o ToolBar (NO toolbar)
window.open("https://google.com","foo","width=800, height=780")
Opens PopUp with ToolBar
window.open("https://google.com","foo","width=800, height=780, toolbar=1")
w/o dimensions
Opens New Tab
window.open("https://google.com","foo")
window.open("https://google.com","foo", "toolbar=1")
The only option for Chrome is to not specify a third argument. Chrome ignores the third argument as they are rightly allowed to do according to the HTML 5 specification, but if present the window appears to always open in a floating widow without controls.
If you do not specify a third argument the window that opens will be a new tab and will have all of the features the user needs.
If you do specify a third argument you will get a new floating window with no controls other than the URL display.
I know this is an old post, but the most recent answer is from September, 2013, so I am taking that as a reason to follow up with this answer. Advance apologies if this is not proper etiquette.
https://code.google.com/p/chromium/issues/detail?id=82522
That's the link to the bug over on the Chrome support page.
I am posting it here in the hope that others experiencing this problem will raise attention to this issue, as suggested in a previous answer.
My apologies for posting this comment as a separate answer. I don't have enough karma to do this the right way.