I know that logging out is not available within RBA.
Btw. If you only stay within RBA, window.open should probably also work.
What I would like to hear from IBM is how to use the functions they already made as a "client user/consultant programmer".
I did put the code in the AppCustomizations.js btw and played around with it, and it did not work.
I know it was a longshot, and it is in the same category as the Add Attachment post from me yesterday.
Hopefully somebody can explain us how to do it.
Because for me it is important. I have a customer who wants to have quite some modifications on Mobile to get Mobile to work for them.
Anyway, I am happy with a forum like this one.
Original Message:
Sent: Thu January 18, 2024 04:47 PM
From: Ritesh Ranjan
Subject: Mobile javascript; how to launch an external browser like Chrome with an URL
Hi Vincent,
From RBA, navigator app is not accessible so that's why I was looking for a custom log out click feature. Also I did not deep dive into navigator app.
Also, I just figured out the part for opening that URL in a same tab instead of new tab.
Now the info you shared on logout controller is interesting. Though I am not sure how to call this function in RBA via app.xml.
Just a thought.. what if we copy the controller file itself in techmobile folder and also add "user-profile-enabled=" true" in techmobile app.xml?
will it work then?
'The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com' Internal - General Use
Original Message:
Sent: 1/18/2024 4:22:00 PM
From: Vincent Wanders
Subject: RE: Mobile javascript; how to launch an external browser like Chrome with an URL
There is a logout controller within Mobile (Navigator).
import { log } from "@maximo/maximo-js-api";
const TAG = "LogoutController";
class LogoutController {
pageInitialized(page, app) {
this.app = app;
this.page = page;
//Hide navigator menu
const event = new Event('CLOSE-NAVIGATOR');
window.dispatchEvent(event);
/* istanbul ignore next */
try {
document.getElementById('navigator').getElementsByTagName('header')[0].style.visibility= 'hidden';
} catch (err){
log.e(TAG,'Unable to hide navigator footer')
}
log.t(TAG, "pageInitialized : is initialized");
}
}
export default LogoutController;
Question could be how to call this function from an app like Techmobile through App.xml or a function within AppCustumizations.js?
------------------------------
Vincent Wanders
Original Message:
Sent: Thu January 18, 2024 03:32 PM
From: Ritesh Ranjan
Subject: Mobile javascript; how to launch an external browser like Chrome with an URL
Hi @Steven Shull,
This is a very nice suggestion. I am trying to make use of this to add LOGOUT click in RBA app with this URL - https://maximohost/maximo/webclient/login/logout.jsp
and it seems to be working. It opens a NEW TAB and shows up Maximo core login page.
I also noticed that session entry is getting removed from maxsession table and logout entry is also getting written into LOGINTRACKING table.
Do you think that there could be any side effects or any other kind of harm if I use the above approach?
Please advise if any.
Additionally, I was going through Browser.js file in MAF container to see what all functions are available. I was trying to find if there is any other function which will open the URL in the SAME TAB instead of NEW TAB in the browser.
Please advise on this too if feasible.
Note: At the moment, I am not sure what would be the behavior in SAML SSO environment!!
Thanks in Advance.
------------------------------
Ritesh Ranjan
Original Message:
Sent: Fri December 22, 2023 08:08 AM
From: Steven Shull
Subject: Mobile javascript; how to launch an external browser like Chrome with an URL
Your code snippet is HTML which you cannot directly interact with in MAF (Maximo Application Framework). To open a link outside of the container on mobile (while still supporting the web role based application scenario), you want to do something like below in your AppCustomizations.js and tie the openGoogle() to an event like an on-click on a button in the app.xml.
import {Browser} from '@maximo/maximo-js-api';
openGoogle()
{
let url="https://google.com"
if(this.app.device.isMaximoMobile)
{
try{
window.cordova.InAppBrowser.open(url, "_system", 'location=yes');
}catch(error)
{
Browser.get().openURL(url);
}
}else{
Browser.get().openURL(url);
}
}
------------------------------
Steven Shull
Original Message:
Sent: Thu December 21, 2023 05:46 AM
From: Vincent Wanders
Subject: Mobile javascript; how to launch an external browser like Chrome with an URL
I would like to launch an external browser with any webpage from the appCustomization.js
window.open is not what i am looking for (that one does really Not work in Maximo mobile).
Maybe I have to do something with Intent. Ofcourse i tried a few things, but also no succes.
Have anyone an idea. Because it is really important for the customer to get it working!
Some code I have is:
<a href="intent:https://example.com#Intent;end" target="_blank"> Open Browser</a>
Is there any way to get this into mobile? Through the app.xml maybe?
------------------------------
Vincent Wanders
------------------------------