document.addEventListener('DOMContentLoaded', function() {
document.getElementById('practitioner').value = 'Nicollette Landsberg';
// ------- Back to Search Practitioners ------- //
// Get all back link elements with data-back-link attribute
const backLinks = document.querySelectorAll('a[data-back-link]');
backLinks.forEach((backLink) => {
// Get the expected back path from data attribute
const expectedBackPath = backLink.getAttribute('data-back-link');
// Get the referrer URL
const referrer = document.referrer;
if (referrer) {
try {
// Parse the referrer URL
const referrerUrl = new URL(referrer);
// Check if the referrer pathname matches the expected back path
if (referrerUrl.pathname === expectedBackPath) {
// Update the href with the full referrer URL
backLink.href = referrer;
console.log('Back link updated to:', referrer);
} else {
console.log('Referrer path does not match data-back-link for element:', backLink);
}
} catch (error) {
console.log('Error parsing referrer URL:', error);
}
} else {
console.log('No referrer available');
}
});
});
-->