Tengo un error en el que el evento de 'carga' de javascript no se activa. Esto solo sucede cuando navego al código que pasa por php; sin embargo, cuando navego a un archivo html, funciona bien.
El evento 'cargar' en el navegador SÍ se activa
prueba.html
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script> // Show all events that have fired Object.keys(window).forEach(key => { if (/^on/.test(key)) { window.addEventListener(key.slice(2), event => { console.log(event); }); } }); </script> </head> <body> </body> </html>El evento 'cargar' en el navegador NUNCA se activa
aplicación.blade.php
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>{{ config('app.name', 'Laravel') }}</title> {{-- Fonts --}} <link rel="stylesheet" href="https://rsms.me/inter/inter.css"> {{-- Styles --}} <link href="{{ mix('/css/app.css') }}" rel="stylesheet" /> {{-- Scripts --}} @routes <script src="{{ mix('/js/app.js') }}" defer></script> <script> // Show all events that have fired Object.keys(window).forEach(key => { if (/^on/.test(key)) { window.addEventListener(key.slice(2), event => { console.log(event); }); } }); </script> </head> <body> @inertia </body> </html>Uso laravel sail en WSL2.
Cosas que he probado:
Esto terminó siendo un conflicto con una dirección IPV6.
Enumeré los procesos que se ejecutan en IPv4 e IPv6 y descubrí que ambos protocolos intentaban usar localhost en el puerto 80.
Ejecuté el comando de eliminación en el proceso de IPv6 y el navegador comenzó a comportarse correctamente.