Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Why would fetch HEAD cause 10 second delay on mobile devices?

Дата публикации: 08-09-2026 23:32:31


In the below click event listener I do a HEAD request against a file to make sure it exists before I attempt to use it. It works great on desktop, but on a mobile device (I test connect to Wi-Fi), it adds ~10s delay in the JS execution. You tap a link and just nothing happens for that time, and then everything continues.
How can this be? Is there something I can change to prevent the delay?
link.addEventListener("click", async (e) => {
e.preventDefault()
const filelink = link.pathname
if((await fetch(filelink,{method: 'HEAD'})).ok == true) {
audiodlg.showModal()
player.src = filelink
document.querySelector("dialog > span").innerText = filelink.substring(filelink.lastIndexOf('/')+1)
}
9 posts - 2 participants
Read full topic

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1What are the best practices for improving website performance in modern web development?0817-09-2026
2I'm kopfoderzahlmnzwurf – web developer & SEO specialist011.8718-09-2026
3What makes a small web utility useful and trustworthy?05.3305-10-2026
4Mobile Menu Help08.9802-10-2026
5Best way to build a responsive multi-field booking form?06.3801-10-2026
6What’s a sensible way to handle a daily word puzzle backend in PHP?06.6218-09-2026
7Elevated request latency014.401-10-2026
8How should a small service business design a simple booking flow without hurting conversions?08.0621-09-2026
9Reply To: Change spacer height for mobile?018.1401-10-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 9. Тональность: 0. Информативность: 8.58. Источник: www.sitepoint.com.