In Many application, many of popups are implemented using window.showmodaldialog which restricts user to finish work on popup before changing focus to any other aprt of application. I want to change the implementation from modal dialog (window.showmodaldialog) to independent window (window.open). could you please help me with steps which has to be followed ?
It is quite simple window.open([URL], 'width=[some number],height=[some number]');.
In this if you have any return values with window.showmodaldialog which you are using in the opener window, you have to handle them with window.opener.
Have a look at https://developer.mozilla.org/en-US/docs/DOM/window.open http://www.w3schools.com/jsref/met_win_open.asp
Related
I try to open some URL in new tab or window, but any Webkit based browser or Opera are block them. I trying many variants to make that, like window.open() etc. like this:
if(c<q){var l='url';
var g=$('<form action="'+l+'" style="display:none;" target="_blank"></form>')
.appendTo('.append').eq(0);
if(confirm('some text')){g[0].submit();}}
but any results...
- this code not blocked only on Firefox. How to create the right one?
Thank's for any help!
Consider using jQuery UI Dialog. Since it is handled in the DOM, it won't be blocked, and you get a lot more flexibility than native confirm and popups.
The reading of this Avoid browser popup blockers confirm my feelings that add blocker does simply allow popup that are opened by a user generated event.
I'm using dhtmlxgrid and get notified from a user click over one cell through the "onRowSelect" event but calling raise a problem with Firefox and Chrome ad blocker :
window.open(url, "_blank");
Any idea or magic solutions.
Are you using the Dhtmlx Window component? because that call window.open() is pure JS call.
You may try to create a DhtmlxWindow object that is a DIV and it should not be blocked, I used this before and never got problems.
Here's a simple INIT guide to use dhtmlx Window.
http://dhtmlx.com/docs/products/dhtmlxWindows/samples/01_init/01_minimal_init.html
when i try to
window.open()
in IE 9 , it opens it with favorites sidebar (if it was present in parent window) this is behaviour unique to IE , and it breaks dialog windows as I envisioned them. Any hope to fix that?
Since you specified that you're using this for a dialog, I feel I should discourage this. Using window.open() is not ideal for creating dialog boxes.
Some browsers will ignore your 'new window' request, and open it as a new tab. This can be configured by the browser user, so is out of your control.
If the user has toolbars and side panels open, there's a strong likelyhood of them showing up in the new window, which will mangle your layout. Again, you'll need to test this in every browser, and even then you can't be sure without knowing all the config options that might affect it.
Opening a new window does not give you a modal dialog box. You can't prevent the user from clicking back to the parent window and ignoring the dialog box.
Therefore, if you want to make a dialog box, you would be much better off using a javascript library that opens a box inside the current page. It's much more flexible, and gives you much more control over the end result than window.open().
If you're using JQuery, you might want to start by looking here: http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/, but there are stacks of others available (it's a very easy thing to write, especially in JQuery, so there's plenty of plugins out there you can try till you find one which is perfect for you)
Try changing it to window.location.href= 'url + target="_blank"'
As stated in the Title, i'm trying to figure out if it's possible in Javascript to:
Open a popup through my parent site with window.open
Have that popup display in front of the parent
Not lose keyboard focus from the parent window.
So something like the functionality of the popup notification of Windows Messenger for example
Any ideas?
Regards,
user523842 :P
Don't use window.open use instead one of many many alternatives aka overlay window/div.
You can use pure JavaScript for this:
http://library.creativecow.net/articles/chaffin_abraham/full-page-overlay.php
Or one of many jQuery solutions as well, just Google for it.
Not afaik. You can't have a focus window underneath a blurred one, but you shouldn't rely on window manipulation anyway because there's a high probability the thing will open in a tab or some other unpredictable client controlled manner. If you want JS dialogs and tight control, use lightbox techniques.
How to avoid the confirm dialog box “the web page you are viewing is trying to close the window” when trying to close IE popup?
Make sure the window you are trying to close is one you opened with JavaScript, and not the one the user arrived at your site with (complete with history they might want to go back through).
This hack used to work in IE, but not sure if it still does:
window.opener = window;
window.close();