Javascript stopping people from seeing api and server keys [duplicate] - javascript

This question already has answers here:
How do I hide javascript code in a webpage?
(12 answers)
Closed 12 months ago.
Is there a way I can stop people from seeing the Javascript Source code that includes the Server API key and server information?

No, there is not.
You can obfuscate and minify your code, but that doesn't help since your users can look at their browser's Network Inspector instead.

Related

How get user IP at browser without outside APIs? [duplicate]

This question already has answers here:
How to get client's IP address using JavaScript? [closed]
(31 answers)
Closed 6 months ago.
I'm looking for a resolution, how can I get user public IP using only my page. My assumption is not connect to external applications to keep application safe. Page has been built with a ReactJS. Is it possible to do from browser and only JavaScript level? Or do I have to create my custom API to get user IP?
Thanks you advance.
https://codesandbox.io/s/how-to-get-user-ip-address-in-reactjs-kh3xl?from-embed=&file=/src/App.js:140-145
This might be what you're looking for ;)

How to get javascript functions native code [duplicate]

This question already has answers here:
How can I read ‘native code’ JavaScript functions?
(3 answers)
Closed 5 years ago.
Is there any way to see the native code of javascript build-in functions in browser console so I can Know the algorithm efficiency of the function and how it actually works
Ensure you are using an open source browser (or get a job where you get access to the source code of the browser you are using)
Look through that source code of that browser
Native code is program source code that has been compiled to native machine code. The source code isn't on your system unless you get it from some other source. It certainly isn't available to JavaScript.

Why big websites don't prefer localstorage over cookie? [duplicate]

This question already has answers here:
Local Storage vs Cookies
(9 answers)
Closed 6 years ago.
I'd like to ask why big players like facebook, google still uses cookies if localstorage is much better and secure for same.
They are not the same thing at all: you can use them in a similar way, but they serve different purposes.
Take a look at this thread: Local Storage vs Cookies

Can we detect network type using browser javascript code [duplicate]

This question already has answers here:
How do I check connection type (WiFi/LAN/WWAN) using HTML5/JavaScript?
(4 answers)
Closed 8 years ago.
Is there a way to enforce browser or web page to use 3G network ( not Wi-Fi ). I don't want to use any native code, I have to do this in JavaScript code.
It's not so simple at the moment. The browser would have to give out that information. Firefox started recently an experimental feature which allows this via the navigator DOM object, but it's the only browser that supports it so far.
Check out navigator.connection.

Internationalisation of javascript frontend messages? [duplicate]

This question already has answers here:
How to handle localization in JavaScript files?
(3 answers)
Closed 9 years ago.
I need to internationalise the javascript messages in the frontend, I'm using play framework 2.2.1, for backend messages I followed this: http://www.playframework.com/documentation/2.0.x/ScalaI18N
But I could not find anything for frontend, any ideas? Thanks!
Play has no native support for JS internationalization, anyway you can easily do it yourself using common JS files containing objects with labels + small method for finding proper translation.
Check this answer - you'll find there full implementation for Play 2.x

Categories