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.
<div id="iapps-nav-logo"></div>
Include the iapps-nav.js
functions file illustrated below.
document.getElementById("iapps-nav-logo").onclick = function() {onClickIappsLogo()};
var isDragged = false;
function onClickIappsLogo() {
if (isDragged) {
return;
}
let params = window.location.hash.split('launch=')
let url = params.length > 1 ? params[1] : '';
window.location.href = decodeURIComponent(url);
}
dragElement(document.getElementById("iapps-nav-logo"));
function dragElement(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
if (document.getElementById("iapps-nav-logo")) {
// if present, the header is where you move the DIV from:
document.getElementById("iapps-nav-logo").onmousedown = dragMouseDown;
} else {
// otherwise, move the DIV from anywhere inside the DIV:
elmnt.onmousedown = dragMouseDown;
}
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}
function elementDrag(e) {
isDragged = true;
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
setTimeout(dragEnd, 500);
}
function dragEnd() {
isDragged = false;
}
}
Include the iapps-nav.css
file illustrated below.
#iapps-nav-logo {
background: url("assets/iapps-nav.png") ;
position: fixed;
height: 60px;
width: 60px;
background-size: contain;
cursor: pointer;
top: 75px;
left: 10px;
z-index: 25;
}
Copy the iapps-nav.png
image to your assets folder, available below.
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.
Last updated