-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathudid_script.js
More file actions
37 lines (33 loc) · 1.64 KB
/
udid_script.js
File metadata and controls
37 lines (33 loc) · 1.64 KB
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
35
36
37
document.addEventListener('DOMContentLoaded', function() {
// Get query parameters from the URL
const urlParams = new URLSearchParams(window.location.search);
const udid = urlParams.get('UDID');
const deviceProduct = urlParams.get('DEVICE_PRODUCT');
const deviceVersion = urlParams.get('DEVICE_VERSION');
const deviceName = urlParams.get('DEVICE_NAME');
// Check if the elements exist and then insert values
const udidElement = document.getElementById('udid');
const deviceProductElement = document.getElementById('device-product');
const deviceVersionElement = document.getElementById('device-version');
const deviceNameElement = document.getElementById('device-name');
const emailLink = document.getElementById('email-link');
if (udidElement) {
udidElement.textContent = udid;
}
if (deviceProductElement) {
deviceProductElement.textContent = deviceProduct;
}
if (deviceVersionElement) {
deviceVersionElement.textContent = deviceVersion;
}
if (deviceNameElement) {
deviceNameElement.textContent = deviceName;
}
// Construct the mailto link with proper URL encoding for special characters
if (emailLink) {
// Create the subject and body strings
const subject = "This is my UDID from iOS device";
const body = `Hello%0D%0AThis is my UDID: ${encodeURIComponent(udid)}%0DDevice Product: ${encodeURIComponent(deviceProduct)}%0DDevice Version: ${encodeURIComponent(deviceVersion)}%0DDevice Name: ${encodeURIComponent(deviceName)}`;
emailLink.href = `mailto:?subject=${encodeURIComponent(subject)}&body=${body}`;
}
});