Javascript detect closing popup loaded with another domain

As mentioned, same origin policy prevents Javascript from detecting such events. But there’s a quite simple solution which allows you to detect closure of such windows. Here’s the JS code: var openDialog = function(uri, name, options, closeCallback) { var win = window.open(uri, name, options); var interval = window.setInterval(function() { try { if (win == null … Read more

javascript – pass selected value from popup window to parent window input box

If you want a popup window rather than a <div />, I would suggest the following approach. In your parent page, you call a small helper method to show the popup window: <input type=”button” name=”choice” onClick=”selectValue(‘sku1’)” value=”?”> Add the following JS methods: function selectValue(id) { // open popup window and pass field id window.open(‘sku.php?id=’ + … Read more

Change background of EditText’s error message

I would suggest to use @Codeversed solution, but if it doesn’t fit for you for some reason you can use my custom EditText implementation. Usual EditText representation: EditText with error: In few words: I’ve created custom xml state for error display. See related code below: InputEditText.java: import android.annotation.TargetApi; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; import … Read more

Popup window in winform c#

Just create another form (let’s call it formPopup) using Visual Studio. In a button handler write the following code: var formPopup = new Form(); formPopup.Show(this); // if you need non-modal window If you need a non-modal window use: formPopup.Show();. If you need a dialog (so your code will hang on this invocation until you close … Read more

Prompt User before browser close?

Update 2017 All modern browsers do not support custom messages any longer. window.onbeforeunload = function(evt) { return true; } This one for closing the tab: window.onbeforeunload = function(evt) { var message=”Did you remember to download your form?”; if (typeof evt == ‘undefined’) { evt = window.event; } if (evt) { evt.returnValue = message; } return … Read more

HTML / CSS Popup div on text click [closed]

DEMO In the content area you can provide whatever you want to display in it. .black_overlay { display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.8; opacity: .80; filter: alpha(opacity=80); } .white_content { display: none; position: absolute; top: 25%; left: 25%; width: 50%; height: 50%; padding: … Read more

JavaScript window.open only if the window does not already exist

I’d do it like this – basically store all the referenced opened windows on the function itself. When the function fires, check if the window doesn’t exist or has been close – of so, launch the popup. Otherwise, focus on the existing popup window for that request. function launchApplication(l_url, l_windowName) { if ( typeof launchApplication.winRefs … Read more