Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getDeviceInfo() {
- let rootURL = "https://connect.garmin.com/modern/activity/";
- let loc = window.location.href;
- if (loc.indexOf(rootURL) != 0) {
- alert("This bookmarklet script must be run on GC device page (with a URL starting with " + rootURL + ")")
- return;
- }
- let activityID = loc.replace(rootURL, "");
- var xhr = new XMLHttpRequest();
- xhr.open('GET', 'https://connect.garmin.com/modern/proxy/activity-service/activity/' + activityID);
- xhr.setRequestHeader("NK", "NT")
- xhr.onload = function () {
- let obj = JSON.parse(xhr.response)
- let deviceID = obj.metadataDTO.deviceMetaDataDTO.deviceId;
- alert('The device ID for this activity is: ' + deviceID)
- };
- xhr.send()
- }
- getDeviceInfo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement