Forums

Javascript works on local server but not on production

Hello all,

I am building a website with django and have been adding some client side functions with javascript.

All of my other functions run well in both local and production servers, but a script that uses javascript's MediaRecorder API only runs locally and not on production.

Did anyone else have similar experiences? I would appreciate any comments.

Thanks!

Have you checked the JavaScript console in the browser? It might be that, for example, some of the scripts aren't loading, which could lead to an error like that -- if that's the case then you'll see an error in the console.

Thank you very much for the response.

When I open my javascript console I get a message saying:

"getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS"

The details page says my local server is considered a secure origin, and that is probably why it only works locally. Now I know why it wasn't working - Thank you!

Ah, that would explain it! I was about to point you at the appropriate pages to get HTTPS set up, but I can see that you've already found what you need and done it all :-)