-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.html
More file actions
34 lines (31 loc) · 984 Bytes
/
validation.html
File metadata and controls
34 lines (31 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<title>validation</title>
</head>
<body>
<a href="#" id="checkAuthLink">Click Here for access</a>
<script>
document.getElementById('checkAuthLink').addEventListener('click', function(event) {
event.preventDefault(); // Prevent the link from navigating
try {
const parentUrl = window.parent.location.href;
if (parentUrl.includes("builder")) {
// Do nothing if the parent URL contains "builder"
} else {
const urlParams = new URLSearchParams(parentUrl.split('?')[1]); // Get parent URL params
if (!urlParams.has("atok")) {
alert("You are not authorized. Redirecting...");
setTimeout(function() {
window.parent.location.href = "https://www.arcgis.com";
}, 1000);
}
}
} catch (error) {
console.error("Error accessing parent location:", error);
alert("An error occurred. Please try again.");
}
});
</script>
</body>
</html>