Add redirect handler and update buttons to use URL parameters

This commit is contained in:
Daniel LaForce 2024-08-02 11:59:12 -06:00
parent ee68ac8031
commit a1fdde69e2
2 changed files with 27 additions and 11 deletions

View File

@ -41,17 +41,8 @@
<iframe src="https://www.google.com/maps/d/embed?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.03554998301922,-105.29915470303165&z=14"></iframe>
<iframe src="https://www.gaiagps.com/map/?lat=39.03966489533956&lon=-105.32945964046155&zoom=14&loc=14.0/-105.3120/39.0318&pubLink=VVXcZPvEfvAbvRWi5F0DQPNT&folderId=e810350b-1b3f-49bf-8f67-6a497827f190"></iframe>
<div class="buttons">
<button onclick="redirectToMap('google')">View on Google Maps</button>
<button onclick="redirectToMap('gaia')">View on Gaia GPS</button>
<button onclick="window.location.href='redirect.html?dest=google'">View on Google Maps</button>
<button onclick="window.location.href='redirect.html?dest=gaia'">View on Gaia GPS</button>
</div>
<script>
function redirectToMap(map) {
if (map === 'google') {
window.location.replace('/google-maps');
} else if (map === 'gaia') {
window.location.replace('/gaia-gps');
}
}
</script>
</body>
</html>

25
redirect.html Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting...</title>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const destination = urlParams.get('dest');
if (destination === 'google') {
window.location.replace('https://bit.ly/csmsgoogle');
} else if (destination === 'gaia') {
window.location.replace('https://bit.ly/csmsgaia');
} else {
document.body.innerText = 'Invalid destination';
}
});
</script>
</head>
<body>
<p>Redirecting...</p>
</body>
</html>