IApps-Navigation

Add-on Feature
The IApps-Navigation feature provides a method for users to circle back to the IndustryApps platform if they have accessed a third-party application which redirects via a new tab. Please utilise this add-on feature if your applications configuration fits this criteria.
Users utilise many applications on IndustryApps for different use cases, and as such providing a smooth flow transition is important for an improved user experience.

How do I add it?

The feature should be added as code snippets in your client-side application. The add-on will redirect the user back when the IApps back button on-click event is triggered.
Copy the line of code below into your index.html file.
In case of an Angular application a similar framework, you may include the .js and .css files in the angular.json script and style sections.
<div id="iapps-nav-logo"></div>
Include the iapps-nav.js functions file illustrated below.
iapps-nav.js
1
document.getElementById("iapps-nav-logo").onclick = function() {onClickIappsLogo()};
2
3
var isDragged = false;
4
function onClickIappsLogo() {
5
if (isDragged) {
6
return;
7
}
8
let params = window.location.hash.split('launch=')
9
let url = params.length > 1 ? params[1] : '';
10
window.location.href = decodeURIComponent(url);
11
}
12
13
dragElement(document.getElementById("iapps-nav-logo"));
14
15
function dragElement(elmnt) {
16
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
17
if (document.getElementById("iapps-nav-logo")) {
18
// if present, the header is where you move the DIV from:
19
document.getElementById("iapps-nav-logo").onmousedown = dragMouseDown;
20
} else {
21
// otherwise, move the DIV from anywhere inside the DIV:
22
elmnt.onmousedown = dragMouseDown;
23
}
24
25
function dragMouseDown(e) {
26
e = e || window.event;
27
e.preventDefault();
28
// get the mouse cursor position at startup:
29
pos3 = e.clientX;
30
pos4 = e.clientY;
31
document.onmouseup = closeDragElement;
32
// call a function whenever the cursor moves:
33
document.onmousemove = elementDrag;
34
}
35
36
function elementDrag(e) {
37
isDragged = true;
38
e = e || window.event;
39
e.preventDefault();
40
// calculate the new cursor position:
41
pos1 = pos3 - e.clientX;
42
pos2 = pos4 - e.clientY;
43
pos3 = e.clientX;
44
pos4 = e.clientY;
45
// set the element's new position:
46
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
47
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
48
}
49
50
function closeDragElement() {
51
// stop moving when mouse button is released:
52
document.onmouseup = null;
53
document.onmousemove = null;
54
setTimeout(dragEnd, 500);
55
}
56
57
function dragEnd() {
58
isDragged = false;
59
}
60
}
61
Include the iapps-nav.css file illustrated below.
iapps-nav.css
1
#iapps-nav-logo {
2
background: url("assets/iapps-nav.png") ;
3
position: fixed;
4
height: 60px;
5
width: 60px;
6
background-size: contain;
7
cursor: pointer;
8
top: 75px;
9
left: 10px;
10
z-index: 25;
11
}
In case of an Angular application, include the js and css files in the angular.json script and style sections.
Copy the iapps-nav.png image to your assets folder, available below.
iapps-nav.png
iapps-nav.png
66KB
Image
Third-party Applications URL should contain a queryParam - launch. The URL assigned to launch the param will be used to redirect while clicking on the IApps back button.
Example:
https://www.thirdpartyapp.com?launch=https://democustomer.uat.industryapps.net
The Add-on feature repository is available below.