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

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

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 ;)

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

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.

Is possible read the browser history with JS? [duplicate]

This question already has answers here:
Is it possible to detect a visitor's browsing history using JavaScript or PHP?
(5 answers)
Closed 9 years ago.
Is possible read the browser history with Javascript? If the answer is Yes, how can I do it?
I want to read it and save it in a JS variable.
No. Other sites visited by a user are their business, not the business of every website they visit. Browsers do not expose that information to web sites.
Browsers go to pretty serious lengths to plug anything that could leak a user's history to websites
In general history is protected by the browser against javascript accessing it except through back and forward functionality.
Source From : Access my entire browsing history via Javascript

how to use javascript for cookies [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What is the “best” way to get and set a single cookie value using JavaScript
I am trying to figure out how to use cookies with JavaScript. I am trying to store an email address, address, and phone number. Can anyone help? I have tried looking around the google machine for help, but I am not finding anything useful.
Heard of google? :)
http://www.w3schools.com/js/js_cookies.asp
But if you are using HTML5 it is even easier.
http://www.w3schools.com/html/html5_webstorage.asp

can we rename/write to local files in HTML5 [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Modifying Local Files Using HTML5 and JavaScript
I know we can read a local file that has been selected by the user, but is there the ability to rename or write to local files in javascript?
There is no way to natively write the filesystem in Javascript, for obvious security reasons.
However, if you must, there is an ActiveX object (Only in IE). It's Scripting.FileSystemObject.
You will find the documentation about that beast on the msdn site.

Categories