Skip to main content

Page Tak Load di Mozilla Firefox / API tak berfungsi

Jika sistem/portal tersebut boleh diakses menggunakan Chrome atau Edge, tetapi loading mengambil masa yang lama atau gagal load di Mozilla Firefox, semak httpd.conf. pastikan baris di bawah ada dalam file tersebut. Perkara ini berkemungkinan berpunca daripada isu Cross-Origin Resource Sharing (CORS).

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
    Header set Access-Control-Allow-Headers "Content-Type"

</IfModule>


Sumber Rujukan : 

https://chatgpt.com

soalan : "my apache server have problem loading content when user use mozilla firefox. the page load correctly using microsoft edge and google chrome. any idea what is the problem of my apache setting?"

sebahagian jawapan :

8. Cross-Origin Resource Sharing (CORS)

If your site is making cross-origin requests, ensure your CORS headers are correctly set. Firefox might be stricter about enforcing these headers.

Example CORS Headers:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
    Header set Access-Control-Allow-Headers "Content-Type"
</IfModule>