How can I close an UI5 App without close the tab - sapui5

I want to close an UI5 app by pushing the navigation button.
Is this possible ?
Btw: How can I close the app by not closing the tab?
Thanks

Because the app is in fact a "simple" web page, the concept of closing it is somewhat loose. Some ideas that you could try, depending on what you want to achieve:
Try and close the tab, but this will generally not work, because you can only close tabs that you created yourself (see Close Current Tab).
Open the blank page by using window.open("about:blank", "_self");
Open the home page of the browser by using window.home(); (see Sending user to their browser's Home Page using Javascript)
Trigger a "Back" navigation outside of your app (such that the page that was open before your app will be shown). You can use window.go(steps) to go forward / backward in the browser history by a number of steps (negative indicates that you are going backwards). It might be tricky to get the correct number of steps that you have to go back if you have hash-based routing in your app (you could use sap.ui.core.routing.History or a similar mechanism).

Related

How to close the Browser Window using ZK framework?

I need to close the Browser Window Tab, please note not the window widget but the Browser window tab, using ZK framework version CE-9.0.0.
I have already tried the following code segments but no luck:
Clients.confirmClose(null);
Executions.deactivate(page.getDesktop());
page.setComplete(true);
page.removeComponents();
page.invalidate();
Is there any API or way to achieve this using ZK and/or JavaScript?
Is there any way to get the reference to the browser window tab, so that it can be closed programmatically, in ZK and/or JavaScript?
Please note: This window tab is opened manually & not by JavaScript or any other program.
Thanks,
RAS
Close the browser tab from a server directly is not allowed. But you can show a modal window to ask a user to close a browser tab like:
<zk xmlns:ca="client/attribute">
...
<window mode="modal" title="Close the browser tab">
<button label="Yes" ca:onClick="window.close();"/>
</window>
</zk>
Because close() is invoked by users, it will close the browser tab. This could be an alternative. Although it doesn't close a browser tab directly, the modal window covers the whole page. Users can't do anything but to click "yes", so I think most users will just click "yes" to close.
I found it works in Chrome 80, but will fail at Chrome 81. So it's not a good way
The JS to close a window is window.close(), this is a well documented standard browser API. (also answered here)
From a ZK application (server-side) you can call this script via:
Clients.evalJavaScript("window.close()");
However this browser API has strict limitations: In modern browsers you can only close windows via close() that were also opened by javascript. So you can't close the current window in case the user navigated there manually - no way around that, except for using an old browser, which I won't recommend.
e.g. that's what you'll get in Chrome (#81)

Mouseup event is not propagated to a popup window in IE 11

I've a legacy app that features a DND from a popup window to the main one.
It works fine in IE 8 but not in any of the newer versions of IE. The effect results in the drag ghost image being stuck in the source window and not going away after the drop had occurred.
Some debugging did in fact confirm that the 'mouseup' event does not get propagated back to the source window. What can be done to fix it? Many thanks!
ITs a bit hard to begin to answer your question without some code....
use the File>Properties menu to find out which IE security zones the two windows(domains) map too...IE uses a different security model to other browsers... drag/drop is probably not allowed between local web files (using file: protocol) and internet or intranet sites.
Have you used the Dev tool yet to debug it? If you are using showModalDialog (which normally disables context menus) you can right click on a link (a) or input element to display the context menu so you can display the debugger for showModal content page.
If possible include a link to your website or a mashup (jsfiddle) with your questions.

How to open a popup window with an external url in a chrome app? (like window.open with _blank)

I need to open an url on a new and single tab chrome window, as you would normally do with window.open and "_blank", but when done inside a chrome app, the url is opened in a new tab of an already running chrome, ignoring all the window features options (width, height, etc).
Are we doing something wrong or is this a chrome app constrain? Any way to solve it?
Best regards
Sergio
You have two options.
Use a proper API to open a tab, chrome.browser.openTab, but that doesn't give you an ability to open it in a separate window. Such an option would probably be a nice addition, you can try submitting a feature request for it.
Open an app window with a local HTML file that embeds the required web content inside a <webview>. You then have full control over appearance, but lose access to browser's conveniences like cookie/password store of the current user, and have to implement some things yourself like dialog boxes.
I'm afraid a Chrome app cannot interact with the browser itself in a more detailed way by design.

Where should I open initial dialogs in an Eclipse application?

I have an Eclipse RCP application. When the application is started I want to immediately present the user with a login dialog. Where is the best place to do this?
I've tried to use various hooks in the WorkbenchAdvisor and WorkbenchWindowAdvisor, but all of these open a dialog before the application had a task bar icon. In this case the dialog can easily be moved behind other windows and there will be no visual indication that the application is open, and the user might open several instances of the application by mistake.
I could force the dialog to be on top, but that's not a good solution. I want a proper modal dialog. A good example of such a dialog is Firefox's "save page as" dialog. When this dialog is present it is always in front of the main browser window; you must complete or close the dialog before you can effectively resume browsing the web. However, this "save page as" dialog doesn't force itself to be on top of every window, just the browser.
You can make a splash screen your login dialog: see an example here.
First: Is it allowed to have multiple instances open? If not, you have to implement independent from the Login-Dialog-Problem something that prevents opening several instance. Take a look here (btw: I made good experiences with the server-socket thing).
Second: If you overwrite #postWindowOpen in your ApplicationWorkbenchWindowAdvisor the application is up and running (including task-item). The only drawback is that your views are already opened, you have to reload them after a successful login.

Is it reasonable to close child windows if main window is closed in a web application?

In a web application, sometimes you have popups in the application.
Is it reasonable to when the user closes the main window, close all child popup windows if they are open?
keep in mind the main window will not stay on the same page, the user may navigate to other pages within the same application (meaning even if you keep a reference to all opened child windows, new page requests will loose the reference to opened windows etc).
Yes I think this is reasonable request.
When you call window.open you can store the handles to the windows returned from this function and then iterate that collection and call close on them when the parent window closes.
How about adding some javascript into your popups, that checks for the existance of the parent page every x seconds, and if it's gone to refresh the content with a "session timeout" message. I think you should be able to use the "window.opener.closed" property from the popup to check the parent has been closed... Just a thought.
You may be able to keep references to the opened child popup windows in a hidden iframe and close them when the iframe detects the browser closing.
There may be security reasons for it - those child windows may retain session information that should be destroyed when the user logs out of the main window. You don't want to expose the user to the danger of having someone else coming along and using their open browser later, and having access to their session.
But from a UI perspective, I agree that its pretty crummy. I think this is a case where its reasonable for an intranet solution, but a bad idea for the Internet.
Is this any help? You can always try and pass the array containing all children between pages.
http://www.codeproject.com/KB/scripting/WebChildren.aspx