Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just wondering, is it better to use relative or absolute URLs ?


Technically, there is no difference at all in how they function.

But I only use //example.com/ if an API is truly available on both http and https (very unlikely, nearly all APIs should be on https only if they use some form of access token in the querystring for auth), and I only use https://example.com/ if the end point exists on some other domain.

As there is no technical difference I opt to save some bytes in the bandwidth.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: