Skip Close Browser Text

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Skip Close Browser Text

Post by dieter »

Hello,
we start some Genie sessions with a Genie macro like this:
<?xml version="1.0" encoding="UTF-8" ?>
<macro>
<detectonce>
<id row="1" col="15"> Programmnachrichten anzeigen</id>
<key>Enter</key>
</detectonce>
<detect>
<id row="1" col="22"> Anmelden</id>
<id row="2" col="47">System . . . . . :</id>
<close />
</detect>
</macro>

The first "detectonce" skips the "Display Program Message" mask. The second "detectonce" closes the Session if the user does a signoff. (After the signoff the signon screen is displayed and on this mask the close should be done). To avoid the confirm message we have set pui.SkipConfirm=true.

This has worked fine a long time. But now we have problems: After closing the session there appears a screen with "Your session has ended. To complete the log off process, please close your browser window."

I am sure that this message did not appear a few weeks ago. I don't know what has changed. We are on version 4.8.4.

What can we do to skip this message?

Some information to the background of the problem: In our "normal" Genie sessions it is not so important whether the message comes or not. But we often open Genie sessions via a link from a PC-application. Then a special macro brings the user directly to a special program, e.g. showing the customer data matching to the customer in the PC-application. After closing the Genie application the browser window should disappear without any confirm messages or warnings.

Our users are confused because they don't expect the message and they find this message not helpful. And in former times the message did not appear.

Dieter
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Skip Close Browser Text

Post by dieter »

Hello,
probably we just found the reason why the window is not closed anymore. Since July 16, 2014 there is a Chrome fix which prevents the closing:
http://stackoverflow.com/questions/1976 ... e#24855795
Chrome Fixed the security issues on version 36.0.1985.125

Chrome 36.0.1985.125 WEDNESDAY, JULY 16, 2014 Release note
From my observation, this update fixed the issue on using window.close() to close the popup window. You will see this in the console when it fail, "Scripts may close only the windows that were opened by it.". That means The hacky workarounds (Brock Adams's answer) may not work in the latest release.

So, in the previous Chrome released builds, the below code block may worked but not with this update.

window.open('', '_self', '');
window.close();
For this update, you have to update your code accordingly to close the popup window. One of the solution is to grab the popup window id and use

chrome.windows.remove(integer windowId, function callback)
method to remove it. Chrome extension windows API can be found at chrome.windows.

Actually my chrome extension MarkView was facing this issue and I had to update my code to make it work for this Chrome Update. By the way, MarkView is tool to read and write Awesome Markdown Files, it provides features including Content Outline, Sortable Tables and code block syntax highlight with line number.
Do you have an idea how we can close a session properly without the "Close Browser Text" ?
Dieter
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Skip Close Browser Text

Post by Scott Klement »

Browsers often will not allow JavaScript to close windows that were not also opened by the same script.

My experience has been that if you run Genie macro that uses <close /> to close the window from Atrium, it works fine because Atrium created the iframe (tab) that the application runs in. When the time comes to close it, it closes properly.

When you use a similar Genie macro directly from Genie (where Genie is not inside Atrium) it cannot close the window, and will print the "Your session has ended. . ." message. Indeed, this is why we print that message there, so that people will know what to do.

The info you posted says that Chrome used to allow users to work around this behavior by calling window.open('', '_self', '') to make it appear a though they had opened the window, so that the corresponding window.close() would work. As far as I know, we do not use window.open('', '_self', '')? So this would not apply, unless that's something special that you've coded?
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Skip Close Browser Text

Post by dieter »

Hello Scott,

thank you for your reply. Our Java developers found out that there is a specification in HTML5 which defines when a browser may close a window. One condition is that a window may be closed by JavaScript if the window was opened by the same script. This is, what you said also. But there is a second condition: a window may be closed by a different JavaScript if it has no "history" in the navigation bar of the browser. (I don't know how to explain this technically correct.). Our Java developers created a very simple example where you can see this behavior. (But you have to use chrome).

Here is the code of close2.html:

Code: Select all

<!DOCTYPE html>
<html>
	<head>
	</head>

	<body onload="window.close()">
	</body>
</html>
If you save this code to a local file "close2.html" and double click the file (chrome has to be your default browser) you will see only a short flickering. What happens is the following: Chrome opens a new window because of the double click. This means that the window is not opened by a JavaScript but opened by a user action. Then the window is closed by the window.close() function in the script. Therefore you can't see a window. According to our Java developer this demonstrates that a script can close a window although it was not opened by the script.

Now look onto the following code please: (file is "close1.html"):

Code: Select all

<!DOCTYPE html>
<html>
	<head>
	</head>

	<body>
		<a href="close2.html">Continue</a>
	</body>
</html>
If you double click code1.html a window is opened by your user action. You see the word "Continue". If you click it the other script "code2.html" is called. But in this case the window remains on the screen! You will see that the navigation icons in your Chrome became active. According to our Java developers this is the reason why the window can not be closed by the script. (The same script which could close the window in the first example).

Here is a link from http://www.w3.org. It says that a browsing context is script-closable if it is a browsing context whose session history contains only one Document.
http://www.w3.org/TR/html5/browsers.htm ... ndow-close

So our Java developer suspect Genie to do something that fills the session history. If this is right this may be the reason why the "close" in the Genie macro does not close the window.
May be there is a JavaScipt specialist in your team who can find a explanation.

Please excuse my poor technical explanations.

Dieter

Here an addition to my post: I tried to upload the code1.html and the code2.html. But the upload was rejected because the code was identified as a possible attack software.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Skip Close Browser Text

Post by Scott Klement »

dieter wrote: If you double click code1.html a window is opened by your user action. You see the word "Continue". If you click it the other script "code2.html" is called. But in this case the window remains on the screen! You will see that the navigation icons in your Chrome became active. According to our Java developers this is the reason why the window can not be closed by the script. (The same script which could close the window in the first example).
Yes, this works as long as I'm very careful to have nothing in history. For example, if I open the browser and then type 'http://mysystem/close2.html' into the address bar, it doesn't work because my home page will be in the browser history. If I make sure that close2.html opens in a brand new tab, it does indeed close the screen.

I created a macro that's the same as yours (except with English strings, since my system is set up for English -- but this shouldn't matter) and when I go back to the Sign On screen the macro will do the <close>, and Chrome will put this on my display:
confirmnav.png
confirmnav.png (5.95 KiB) Viewed 2101 times
Is that also what you are seeing? Or are you just getting the "Your session has ended" without this popup dialog? Like your close1/close2 html examples, I only get this popup if I'm careful to have nothing in my history when I launch Genie.

Genie all runs from a single HTML page, it does not link forward to things, so should not be adding anything to history. The screen is redrawn dynamically using AJAX calls, so it never navigates to a new page... There is one thing that Genie does do to history --- it tries to manipulate it so that the user cannot hit the back button. It is possible that this is causing a problem for you? But it doesn't seem to be causing one for me.... unless you're trying to avoid that popup?

I'm running Chrome Version 36.0.1985.125 m
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Skip Close Browser Text

Post by Scott Klement »

If the problem is the "Confirm Navigation" popup that I showed in my last example, then you can disable that by setting pui.confirmOnClose = false in your Genie skin. Details are here:
http://www.profoundlogic.com/docs/displ ... n+on+Close

When I have that disabled, my macro is indeed closing the window for me, as long as I'm careful not to put anything in history. I tried disabling/enabling the code that modifies history so that the back button is disabled, but it doesn't seem to have any effect at all on whether the window closes. It still closes both with and without that code inside Genie. So I don't think that's the problem (unless you're running a different version of Chrome, maybe?)
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Skip Close Browser Text

Post by dieter »

Hello Scott,

thank you for your effort. Our Problem is not the confirm message "Are you sure you want to leave this page?". This message we can skip by "pui.skipConfirm=true". This works fine. Our problem is the page "Your Session has ended ...". This page appears although we have set "pui.skipConfirm=true".

But i think in the moment the problem is not very urgent. So i suggest that we defer the problem. Maybe sometime in the future somebody has an idea.

Dieter
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Skip Close Browser Text

Post by Scott Klement »

Yes, I understand that you're getting the close browser text.

In my attempts to reproduce the problem that you're having (running the script that you provided, in Chrome as you specified) the ONLY time I get the close browser text is:

1) When I get that popup dialog I mentioned in the previous message. (the close browser text appears behind the popup on the screen)
-or-
2) When I have something in my history.

So I wasn't sure if #1 was what you were referring to. Thank you for clarifying that it is not.

Something else is happening to you that isn't happening to me. That script doesn't do very much (just skips the 'display program message' screen, and closes the tab when the sign on screen appears). Presumably, the user runs some specific actions while the script is active. Is it possible that there is some widget or something like that which is manipulating the browser history?
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Skip Close Browser Text

Post by dieter »

The only thing we have noticed is, that a Genie session, which is called by a script (not by a user action) normally has no browser history. Even if you call different programs which have display files, the browser history stays empty. But if you call a native ProfoundUI program then the browser history seems to contain data. At least the navigation arrow becomes active.

So we first thought that this causes the problem. (But we now think that it does not). In our typically Genie sessions we want to have the confirm message. But under special conditions we want to skip the confirm message. To realize this we have wrote a tool which opens an empty ProfoundUI mask. In this mask the onload event does a "pui.SkipConfirm=true" and a pui.click(). So the tool is hardly visible by the user. The user only sees a short flickering on the screen. But the effect is that after the tool is called the flag for skipping the confirm message is set. If we call this tool in a "normal" Genie session which has no browser history the back-navigation-arrow of the browser history becomes active. So we thought that this prevents closing the tab. But we made a test which showed that this activation of the history is not allways the problem.

We made the following tests:

Test 1:
1. Open a new tab in chrome
2. Create a Genie session in this tab by typing the suitable url. Then you see that the browser navigation arrow becomes active.
3. Open the developer tools in the browser and go to "console".
4. Type pui.skipConfirm=true;
5. Type window.close()
The effect is that the tab stays open. But this seems to be OK because of the opening of the tab by a user action the navigation history is not empty and the browser prevents closing the tab.

Test 2:
1. Create a Genie session by doubleclicking a suitable link. In this case the tab is not opened by a user action and there is no browser history.
2. Open the developer tools in the browser and go to "console".
3. Type pui.skipConfirm=true;
4. Type window.close()
The effect is that the tab is closed. This seems to be explainable because of "no navigation history" => "the browser may close the tab".

Test 3:
1. Create a Genie session by doubleclicking a suitable link. In this case the tab is not opened by a user action and there is no browser history.
2. In the Genie session call any "native" ProfoundUI program. Then the browser back navigation arrow becomes active. So it seems to be that the browser history is filled.
3. Open the developer tools in the browser and go to "console".
4. Type pui.skipConfirm=true;
5. Type window.close()
In this case the tab closes even if there is a history!!!!!!

It seems to be that the problem only occurs if a Genie macro is called in the session.

I don't know if this information helps.
But i wanted to let you know what we found.

Dieter
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests