A pop that disables parent window - html

I know how to show a pop-up window. But I will like to freeze or disable the parent window when there is a pop-up window active. Once the pop-up window is closed, the parent window should automatically be active again.
How exactly is it done?

You do not neet o remake the wheel.
Take a look at this page.
It's a JQuery plugin that does exactly what you ask, and much much more.

It is just my personal idea, but I would think, the solution could be when open the pop up windows, you just override the click function of the parent document to return false, and set it back to normal when they close the pop up window, some JavaScript code will need to be used here

I'm guessing you want a modal dialog box? Most of these disable the parent window by positioning an overlay... Here is a list of 22 different plugins ( you don't need to read German to use this site :P )

Related

Primefaces:dialog minimizable option not working with modal

While enable the minimize option in dialog box with modal as true, then by clicking the minimize, background modal[grey bg] not getting removed. And also, i cannot able to maximize the dialog, which is minimized at the left bottom corner.
I tried using appendtobody, and its not working.
Note:I am using PF 3.4.2
Thanks,
It was resolved by adding higher z-index to ".ui-dialog-docking-zone".
I don't think that it is a good idea to minimize modal dialogues just because of their nature. Modal dialog says to user stop what are doing now and resolve the issue which is displayed, because it's important. That is why page (or window) under the dialog stays unresponsive, until the task is done. So if I may recommend you, don't use modal dialogues if you need the option to minimize them.

How to create a canvas in HTML5 that looks like a window

I want to create a HTML page, in which a button click will open a window dialog (a canvas that looks like a window with close and resize options). How do I go ahead creating this design. Any idea?
As per my requirements, i found solution with JQueryUI modal dialog that has re size and dragging.
Special thanks to #wisdom and #Jarrod for their help in finding me a solution.

dynamically set height of browser action popup based on window size

When a user clicks my browser action I'd like it's corresponding popup window to (almost) fill the screen. I need the:
height/width of the current window
WHEN
the user clicks my popup
I know I can get the height/width of the current window with chrome.windows.getCurrent(function(currentWindow) { console.log(currentWindow.height); });, however I don't know how to tell that my popup was opened (event), or how to dynamically set it's size (setting document.body.width or window.inner/outerWidth in the popup's inspector doesn't seem to do it). Thanks!
Edit: found http://code.google.com/chrome/extensions/browserAction.html#event-onClicked , however it says it will not fire it a browser action has a popup, is binding to onload in the popup page what I'm trying to achieve?
window.resizeTo resizes the browser window.
You can pass this information between your parent window and the child popup in any of many creative ways. The simplest I can think of that's pretty much assured to work would be to tack on the dimensions in a query string or hash for the child window URL and then to parse it with JS.
The usual disclaimer applies that there is almost always a better "way" to do things than resizing the browser window.

Html popup window, the parent should have no access

I'm trying to create a popup() where user clicks on button, then it triggers window where he does some edit.
While the user is editing in the child window, parent window should not be accessed, it should be blocked.
How exactly should i do this?
This is what i'm doing now.
function Popupwindow()
{
name = "Select Requestor";
url = "selectLocation.html";
options = "height=330, width=210, location=no, scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,left=0";
window.open(url,name,options);
}
So now i'm able to close parent window and even edit parent elements without closing child window.
What you want is called a modal dialog. There's no standard way to do this across multiple browsers, some don't even have anything like it. Your best bet is creating a modal dialog inside the page. Most JS frameworks/toolkits will provide dialogs.
don't use "real" popups, use javascript to "emulate" them in teh same window. take a look at jquerys dialog, where you can also set the modal-mode (example and example) - i think this is what you want.
there are a lot of standalone-js examples out thre if you're not using jquery and a lot of js-frameworks include things like this - just search for "modal dialog".

Open a new browser window WITHOUT using target="_blank"

Every solution I've seen so far for opening a new browser window uses the target property in to set it to "_blank". This is frustrating because in some browsers it only opens a new tab AND combine that with the auto-resizing behvaiour at http://www.facebook.com/connect/prompt_feed.php?&message=test, it basically mangles my browser whenever I try updating my status from my site.
How can I be sure to open a new window when a user clicks on a link?
Thanks!
Trindaz on Fedang
Popups are windows, they just have some features disables. You can make a popup act like a regular window by enabling these features. For example, if you open a popup with
window.open('url', 'name', 'width=500, height=500, status=1, toolbar=1, location=1, menubar=1, resizable=1');
the window will have a toolbar, a URL bar, a status bar, menus, and it will be resizable. It will the same as any other window.
Keep in mind, however, that many browsers block window.open() under some conditions, and some of them will open new tabs if you specify a lot of features. Some are weird about it too; Chrome, for example, uses scroll bars on popups by default, but if you specifically tell it to use scroll bars in a popup (using scrollbars=1), it will open in a tab instead.
So basically there is no way to be completely sure that your page will always open in a new window, because browsers all handle this stuff differently, users can change settings too. The code above is probably your best bet if you have to have a new window, but you might want to look into other options.
window.open(URL,name,specs,replace)
function newwindow()
{
myWindow=window.open('','','width=300,height=300');
myWindow.document.write("<p>This should open in a popup</p>");
myWindow.focus();
}
There is a legitimate reason for using Target=_blank that everybody has completely overlooked, and that is when a website is written as a BOOK with chapters/pages and the Table of Contents must remain intact without using the BACK button to reload the previous page (Table of Contents). This way all a surfer needs to do is close the Target Page when finished reading and they will be back to the Table of Contents.
Lucky for us that HTML5 has reinstated the Target="_blank" code, but unfortunately the "Block Popups" must be unchecked for it to work.