PageSourceSearch

https://www.ionos.ca/js/sessions.js

js ionos.ca collected 2026-09-24 17:09:41 UTC 1,720 bytes, 69 lines download raw bytes

1// Function to create a session
2
3function createSession() {
4	let tld = window.location.hostname.split('.').pop();
5	let market = window.location.hostname.split('.').pop();
6	if (market === 'com') {
7		market = 'us';
8	}
9	if (market === 'at') {
10		market = 'de';
11	}
12	if (tld === 'localhost') {
13		market = 'localhost';
14		tld = 'de';
15	} else if (tld === 'lan') {
16		market = 'localhost';
17		tld = window.location.hostname.split('.').reverse().pop();
18	}
19	if (tld === 'uk') {
20		tld = 'co.uk';
21	}
22
23	fetch(`https://shop-api.ionos.${tld}/v1/api/shop/session`, {
24		method: 'GET',
25		credentials: 'include',
26		headers: {
27			'Content-Type': 'application/json',
28			'x-market': market,
29		},
30	})
31		.then((response) => {
32			response.json();
33		})
34		.then(() => {
35			window.sessionStorage.setItem('hasSession', 'true');
36			// Save the timestamp
37			window.sessionStorage.setItem('sessionTimestamp', Date.now());
38		})
39		.catch((error) => {
40			window.sessionStorage.removeItem('hasSession');
41			window.sessionStorage.removeItem('sessionTimestamp');
42			console.error('There was a problem with the fetch operation:', error);
43		});
44}
45
46function isSessionExpired() {
47	const sessionTimestamp = window.sessionStorage.getItem('sessionTimestamp');
48	if (sessionTimestamp) {
49		const oneHourAgo = Date.now() - 3600000; // 1 hour in milliseconds
50		if (parseInt(sessionTimestamp) < oneHourAgo) {
51			window.sessionStorage.removeItem('hasSession');
52			return true; // Session has expired
53		} else {
54			return false;
55		}
56	}
57	return true;
58}
59
60if (!window.sessionStorage.getItem('hasSession') || isSessionExpired()) {
61	console.log('no session');
62	createSession();
63}
64
65setInterval(() => {
66	if (!document?.hidden && isSessionExpired()) {
67		createSession();
68	}
69}, 10000);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.