
My Support
Get up to date information on your repairs, reservations, and tech support cases. Purchase or register AppleCare products.
And much more.


Support app
Get personalized access to solutions for your Apple products.
{ // Check if the URL changed to a search URL if (window.location.pathname.includes('/search')) { const currentUrl = window.location.href; if (!currentUrl.includes(PROXY_HOST + '/browse')) { // This is a direct search URL, redirect through proxy const targetSearchUrl = TARGET_URL.replace(//$/, '') + window.location.pathname + window.location.search; window.location.href = PROXY_HOST + '/browse?u=' + encodeURIComponent(targetSearchUrl); } } }, 100); } } }); // FIXED: Override form submissions with proper URL resolution and error handling document.addEventListener('submit', function(e) { const form = e.target; if (form.tagName === 'FORM') { console.log('=== FORM SUBMISSION DETECTED ==='); console.log('Current page TARGET_URL:', TARGET_URL); console.log('Current page PROXY_HOST:', PROXY_HOST); // Get form action let action = form.getAttribute('action') || ''; console.log('Form action attribute:', action); console.log('Form method:', form.getAttribute('method') || 'GET'); console.log('Form HTML:', form.outerHTML.substring(0, 200) + '...'); // Debug: Check if this form has been rewritten already if (action.includes(PROXY_HOST)) { console.log('Form action already contains PROXY_HOST, allowing submission'); return; // Let it submit normally } // If action is already a proxy URL, don't intercept if (action.includes('/browse?u=') || action.includes('/proxy/')) { console.log('Form action is already a proxy URL, allowing normal submission'); return; // Let it submit normally } e.preventDefault(); // Prevent default submission console.log('Intercepting form submission'); // If no action or empty action, use current page if (!action || action === '#' || action === '') { action = TARGET_URL; console.log('Empty action, using TARGET_URL:', action); } // Resolve the action URL with proper base let resolvedUrl = resolveUrl(action, TARGET_URL); console.log('resolveUrl result:', resolvedUrl); // If resolveUrl failed but action looks like a relative path, try manual construction if (!resolvedUrl && action.startsWith('/') && !action.startsWith('//')) { try { const targetUrlObj = new URL(TARGET_URL); resolvedUrl = targetUrlObj.origin + action; console.log('Manually constructed URL:', resolvedUrl); } catch (e) { console.warn('Failed to manually construct URL:', e); } } if (!resolvedUrl) { console.error('Could not resolve form action:', action); console.error('TARGET_URL:', TARGET_URL); console.error('This form submission will be aborted'); return; } console.log('Final resolved form action:', resolvedUrl); // Build form data const formData = new FormData(form); const method = (form.getAttribute('method') || 'GET').toUpperCase(); console.log('Form data entries:'); for (const [key, value] of formData.entries()) { console.log(' ', key, '=', value); } if (method === 'GET') { // For GET, append form data to URL as query parameters const url = new URL(resolvedUrl); for (const [key, value] of formData.entries()) { url.searchParams.append(key, value); } const finalUrl = PROXY_HOST + '/browse?u=' + encodeURIComponent(url.href); console.log('Redirecting GET form to:', finalUrl); window.location.href = finalUrl; } else { // For POST, create a temporary form and submit const proxyForm = document.createElement('form'); proxyForm.method = 'POST'; proxyForm.action = PROXY_HOST + '/browse?u=' + encodeURIComponent(resolvedUrl); // Add all form data as hidden inputs for (const [key, value] of formData.entries()) { const input = document.createElement('input'); input.type = 'hidden'; input.name = key; input.value = value; proxyForm.appendChild(input); } console.log('Submitting POST form to:', proxyForm.action); document.body.appendChild(proxyForm); proxyForm.submit(); } } }); // FIXED: Override link clicks for better handling with proper error checking document.addEventListener('click', function(e) { // Don't intercept clicks on interactive elements const target = e.target; const interactiveElements = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'OPTION']; if (interactiveElements.includes(target.tagName)) { return; // Let the click proceed normally for interactive elements } // Check if we're clicking inside an interactive element const interactiveParent = target.closest('input, textarea, select, button, [contenteditable="true"]'); if (interactiveParent) { return; // Let the click proceed normally } const link = e.target.closest('a'); if (link && link.href && !link.href.includes(PROXY_HOST)) { if (!link.href.startsWith('javascript:') && !link.href.startsWith('mailto:') && !link.href.startsWith('tel:')) { // Don't intercept if it's already a proxy URL const hrefAttr = link.getAttribute('href'); if (hrefAttr && (hrefAttr.includes('/browse?u=') || hrefAttr.includes('/proxy/'))) { return; // Let it proceed normally } e.preventDefault(); const resolvedUrl = resolveUrl(hrefAttr, TARGET_URL); if (resolvedUrl) { window.location.href = PROXY_HOST + '/browse?u=' + encodeURIComponent(resolvedUrl); } } } }); // FIXED: Override window.open with proper error handling const originalWindowOpen = window.open; window.open = function(url, ...args) { if (url) { const resolvedUrl = resolveUrl(url, TARGET_URL); if (resolvedUrl) { url = PROXY_HOST + '/browse?u=' + encodeURIComponent(resolvedUrl); } } return originalWindowOpen.call(this, url, ...args); }; // Prevent setTimeout/setInterval redirects const originalSetTimeout = window.setTimeout; window.setTimeout = function(func, delay, ...args) { if (typeof func === 'string') { // Check if the string contains redirect code if (func.includes('location') || func.includes('window.top') || func.includes('parent.')) { console.log('Blocked potentially malicious setTimeout:', func); return null; } } return originalSetTimeout.call(this, func, delay, ...args); }; const originalSetInterval = window.setInterval; window.setInterval = function(func, delay, ...args) { if (typeof func === 'string') { if (func.includes('location') || func.includes('window.top') || func.includes('parent.')) { console.log('Blocked potentially malicious setInterval:', func); return null; } } return originalSetInterval.call(this, func, delay, ...args); }; })();

Get up to date information on your repairs, reservations, and tech support cases. Purchase or register AppleCare products.
And much more.


Get personalized access to solutions for your Apple products.