2023-06-22 12:14:43 -04:00
|
|
|
// This function is executed when any page on the website finishes loading and
|
2023-06-19 12:38:45 -04:00
|
|
|
// this function retrieves the cookies if it is present on the user's machine.
|
|
|
|
// If it is available then the saved cookies is display in the cookies tab
|
2023-06-18 13:12:20 -04:00
|
|
|
// otherwise an appropriate message is displayed if it is not available.
|
2023-06-18 12:50:32 -04:00
|
|
|
document.addEventListener(
|
|
|
|
'DOMContentLoaded',
|
|
|
|
() => {
|
2023-06-19 12:38:45 -04:00
|
|
|
try {
|
|
|
|
let cookie = decodeURIComponent(document.cookie)
|
2023-06-18 12:50:32 -04:00
|
|
|
document.querySelector('.cookies input').value =
|
2023-06-19 12:38:45 -04:00
|
|
|
cookie !== '' ? cookie : 'No cookies have been saved on your system'
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Error decoding cookie:', error)
|
|
|
|
document.querySelector('.cookies input').value = 'Error decoding cookie'
|
2023-06-18 12:50:32 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
false
|
|
|
|
)
|