window.open() of javascript, it is working fine in other browsers, but in case of ie-8 it shows some error such as popup.
You're probably getting stopped by the pop-up blocker.
window.open ("http://www.location.com", "mywindow","status=1,toolbar=1");
The allowed parameters are as below
status The status bar at the bottom of the window.
toolbar The standard browser toolbar, with buttons such as Back and Forward.
location The Location entry field where you enter the URL.
menubar The menu bar of the window
directories The standard browser directory buttons, such as What’s New and What’s Cool
resizable Allow/Disallow the user to resize the window.
scrollbars Enable the scrollbars if the document is bigger than the window
height Specifies the height of the window in pixels. (example: height=’350′)
width Specifies the width of the window in pixels.
(Shamelessly copied from here)
Related
I am showing alert on this. But alert is clipped on the either sides, width of popup is 320px. How can I display the entire alert ?Pop-up screen
That problem occurs when Chrome is running on Windows 7. It occurs when alert is smaller than 370px. I have the same problem and I found that it is a bug in Chrome when is used on Windows 7.
In your screenshot the popup is cropped to the parent window size.
Resize the window to show the full alert box.
In all browsers I know the alert-box is always a child of the browser window, so it can never reach outside the browser window.
Option 1
You could use JS to resize the browser window (e.g. make window wider before alert, smaller again after alert):
window.resizeTo( width, height );
Option 2
Create your own JS popup box instead of using alert(). You cannot style the alert() box, but you can control size/design of a custom popup you create
I'm trying to create a simple pop-up window using this JS code:
window.open(this.href,"popupwindow", "width=400,height=545,innerHeight=500, left=200,top=5,scrollbars,toolbar=0,resizable");
The resultant pop-up window is showing different heights for different browsers. I checked the window.innerHeight through console on different browsers, and this is the result:
safari: window.innerHeight= 455
chrome: window.innerHeight= 500
IE: window.innerHeight= 549
Firefox: window.innerHeight= 544
Here is the JSFiddle link.
I need the pop-up with the height of 500px. How can I do that across all browsers.
Resizing the window after opening may achieve better size accuracy:
var win = window.open("about:blank" "popupwindow", // about:blank for demo
"width=400,height=500,left=200,top=5,scrollbars,toolbar=0,resizable");
// adjust size;
win.resizeBy( 400 - win.innerWidth, 500-win.innerHeight);
requests a window 400 x 500 pixels and then resizes the content area to make sure. Treatment or even recognition of innerHeight and width settings may differ between browsers.
However
Popup windows are subject to user preferences and popup blockers. For example I have IE set to open popups in a new tab (the code above does not open a new window), Firefox to always include the location bar, and regard any site that sets out to circumvent a popup blocker as malicious. You may wish to draw this to the attention of those setting the requirements.
window.open(this.href,"popupwindow", "width=400,innerHeight=500,left=200,top=5,scrollbars,toolbar=0,resizable");
You can't predict the height of window. It's depends on user preferences.
But you only need the innerHeight
I am trying to refer to window.top in my popup window here http://www.globalrph.com/davescripts/popup.htm
once in the popup I want to access the main window's document but window.top is returning undefined.
To access your popup's opener use.
window.opener
To access your opener's top (e.g your opener is in an iframe)
window.opener.top
Once at the opener window you want you can access the document to change its context, the location to manipulate the URL etc.
If you want to move your popup to the same top position as the opening browser window and centered horizontally to the size of the opening browser window, in modern browsers you can use:
window.moveTo(window.opener.screenX + (window.opener.outerWidth / 2) - (window.outerWidth / 2), window.opener.screenY)
outerWidth and screenX and screenY work in IE9 and above and in modern browsers.
moveTo has been around a long time.
In this case we're getting the left position of the opening browser window, calculating its center and subtracting half the width of the popup. That gives the center position. Then we use window.opener.screenY to get the top position of the opening browser window and setting the popup's top the same.
Many browsers have popup blockers turned on by default and will require the user to click a link to open a popup. I have this web application that opens a popup window to preview the results. A lot of web applications use a positioned div for dialogs. Not knowing your application, I really can't give advice as to the best approach to take.
I need to implement the following feature and make it work in Internet Explorer:
User clicks a link in the primary screen.
A popup will be opened in the secondary screen and in fullscreen mode.
Some requirements:
It must work in IE8 (and 9/10)
For simplicity, we can assume that the secondary screen is located on the right of the primary screen. Also, the resolution of the secondary screen is known.
Javascript is used, but VBScript would be also possible.
So far the prototype is working quite well
the popup is opened with window.open with left=screen.availWidth+1 -> will be opened in the secondary screen OK
the fullscreen mode is activated with Wscript.Shell sendKeys({F11}) trick. This has some random issues. Timing etc will make it fail sometimes.
There are couple of IE-specific problems that make the implementation much more difficult
screen.availWidth returns always the primary screen resolution. E.g. Firefox returns the right size for popups located in secondary screen. Otherwise I could mimic the fullscreen mode by positioning the popup to fill the secondary screen completely.
window.open() with "fullscreen=1" works too but it ALWAYS opens the popup in the primary screen. This happens even if I use timers to make it target to secondary screen. Also a temporary pop-up located in secondary screen does not help. Looks like the fs=1 will always open the window in the screen where the click originated.
And for clarity, this will be implemented for an intranet application and has valid and well justified reasons. There is no point to suggest to try another web browser.
Any ideas that has been proven to work are welcome!
I'm looking to create a "pop-up" window that simply displays text within the window without the browser's signature. When I create a window simply by using the window.open command, the Chrome symbol and address bar is displayed.
Is there a way to get rid of this?
Or is there a smarter way of doing this?
Also, with that being said, I want this window to stay on top of all other windows being displayed. That is, I want it to essentially be running on top of a window even though I may be clicking on a full screen window behind it.
No, this is intentionally made not possible (at least in Chrome) because it could be used to confuse the user to think that a browser window is a window for another program.
Google Chrome window.open height includes URL bar