- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 10:28 AM
Hi everyone, good afternoon!
When the user logs in to access the Portal, sometimes it is very slow to perform the redirection to the home screen, would you be able to tell me if there is any way to include a message, such as: gs.InfoMessage(‘Please wait, you will be redirected!’)?
Obs.: this message will appear after a setTimeOut, is it possible?
HTML:
<div>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 01:09 AM
Hi @Elton2 ,
It seems like you want to display a message while the user is being redirected to the home screen after logging in to the ServiceNow portal. Your approach with the client script is on the right track, but there are a couple of things to consider for a smoother user experience.
First, it's important to note that adding a brief delay using setTimeout to simulate a message might not be the most reliable way to achieve this. Also, using location.reload(true) to refresh the page right after logging in might not be necessary and could potentially cause some unexpected behaviors.
Instead, you can use AngularJS to manage the message and redirect more effectively. Here's how you can modify your code to achieve this:
<div>
<!-- Other form elements -->
<!-- Message element -->
<div ng-show="c.displayMessage" class="info-message">
{{ c.messageText }}
</div>
<button name="login" type="submit" ng-click="c.login_in()" class="btn btn-lg btn-primary btn-block login-button-old">
${Login}
</button>
</div>
Client:
c.login_in = function() {
// Show the message
c.displayMessage = true;
c.messageText = "Please wait, you will be redirected!";
// Delay for a moment (e.g., 1 second)
setTimeout(function() {
// Navigate to the home screen (assuming '/home' is the correct URL)
window.location.href = '/home';
}, 1000); // Adjust the delay as needed
};
In this , the message will be displayed using the ng-show directive, and after a brief delay, the user will be redirected to the home screen using window.location.href.
Remember to adjust the delay time in the setTimeout function based on your preference.
Please mark helpful if my answer satisfies your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 01:09 AM
Hi @Elton2 ,
It seems like you want to display a message while the user is being redirected to the home screen after logging in to the ServiceNow portal. Your approach with the client script is on the right track, but there are a couple of things to consider for a smoother user experience.
First, it's important to note that adding a brief delay using setTimeout to simulate a message might not be the most reliable way to achieve this. Also, using location.reload(true) to refresh the page right after logging in might not be necessary and could potentially cause some unexpected behaviors.
Instead, you can use AngularJS to manage the message and redirect more effectively. Here's how you can modify your code to achieve this:
<div>
<!-- Other form elements -->
<!-- Message element -->
<div ng-show="c.displayMessage" class="info-message">
{{ c.messageText }}
</div>
<button name="login" type="submit" ng-click="c.login_in()" class="btn btn-lg btn-primary btn-block login-button-old">
${Login}
</button>
</div>
Client:
c.login_in = function() {
// Show the message
c.displayMessage = true;
c.messageText = "Please wait, you will be redirected!";
// Delay for a moment (e.g., 1 second)
setTimeout(function() {
// Navigate to the home screen (assuming '/home' is the correct URL)
window.location.href = '/home';
}, 1000); // Adjust the delay as needed
};
In this , the message will be displayed using the ng-show directive, and after a brief delay, the user will be redirected to the home screen using window.location.href.
Remember to adjust the delay time in the setTimeout function based on your preference.
Please mark helpful if my answer satisfies your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 12:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:52 AM
Hi @Elton2 ,
If you got it, could you please accept the solution :). Click on Mark as Accept Solution Button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 07:09 AM