home
design & development
Lotus application development
print design
web site development
request a design quote
solutions & consulting
Notes and Domino application development
Lotus Domino administration
Securence Mail Filtering
UNITRENDS backup and recovery
Lotus Notes / Domino Apps
free Lotus Notes apps
hosting
web site hosting
Lotus application hosting
check your mail
request a hosting quote
publishing
media and publishing
sound
client services
help & support
Make Payment
Client Access - Workboard
billing & payment policies
copyright & liability policies
pricing & turnaround policies
privacy statement
contact
e-mail MW
get files
send files
Close Current Window/Tab w/JavaScript Button
Mindwatering Incorporated
Author: Tripp W Black
Created: 12/05/2013 at 01:13 PM
Category:
Notes Developer Tips
JavaScript
Issue:
The window functions:
window.close();
and
close();
won't close a current browser window or tab if the page was launched as a normal link. This is a security feature which is by design. It protects one page from being affected by another tab/page.
So how do you close the current page besides the little "x" in the corner of the tab or window?
Solution 1:
One way to fix the issue is to spawn the page (assuming it's a pop-up type dialog page) with
window.open(...);
This fixes the security limitation and
close();
works again.
Solution 2:
If the page is not a pop-up dialog type of page and is a "normal" web page. This is far from ideal. The page could easily be displayed outside the pop-up paradigm especially via a web search engines results page.
The best work-around that I have used is to quickly open up anything in the current page via JavaScript and then close it.
In the
JSHeader
, enter the following function:
function closeMe() {
var win = window.open('','_self'); /* url = '' or 'about:blank' */
win.close();
}
In the button you have created, change the code from Formula to
JavaScript
/
Common JavaScript
. Enter the following function call:
closeMe();
previous page
×