I just want to know can I create registration page with using javascript in html page and store all details to the client-side cookie session or I should have a database to store all information there?
Any help would be appreciated
This has to be server side, in a database. Why would you want to store this on users computers? What would happen if they moved to a different computer or deleted their temporary internet files? You'd cause problems.
Hi there, I just want to know can I create registration page with using javascript in html page and store all details to the client-side cookie session
You could, but then the user would be registering with their browser rather then with your website, which doesn't appear to make sense.
should have a database to store all information there?
Having a server side system which stores information in a database is the standard approach.
If you want to persist your user information and if you want your user be able to login to your application from anywhere, then you should use a server side database and store your registration information.
Yes, you could do that, but it would not provide any kind of security. It would also mean that you lose out on the ability to keep track of your users, unless the cookie is read by the server. Finally, your user's registration would only be valid on their computer, again unless there is a way for them to retrieve their information from the server (which means the server will need to have it).
If it's a HTML5 app you could use the localStorage and sessionStorage Objects to store your info however if the items you are collecting are security sensitive I'd send the info to a database or a protected file on the server. Leaving sensitive info in a cookie isn't wise.
If you're working with passwords, get that stuff into a database and encrypted/salted!
Related
How do I create a a session that captures user input where by the user can come back and continue from where they had stop while filling a form. Any help thank you in advance because I have no idea on what is the best way to do it
Ideally, you should be storing the information in the database (server side), but if you want it to persist on the client side( across browser sessions) you can use localStorage
To read more about localStorage you can check here
There are other client-side storage techniques, you can choose depending upon your requirement.
Cookies
sessionStorage
IndexedDB
I suggest you to check this link also for the comparison. Client-Side Storage Technology
The standard usage of the word "session" in the client-server model usually describes a scenario where HTTP cookies or cryptography is used to track the visits of a particular user to a site. These are the bare-metal technologies behind user authentication.
The "sessions" you mean in your question are for tracking the continuation of data a user may have been submitted.
Do it server side
Keeps track of the data a user may have submitted.
Save whatever part of the data user maybe submitting.
Load this data back when you serve the form to thew user gain.
Do it client side
Save the user data in the Local Storage of the client's browser.
Look for this data every time the from is loaded to the browser.
However, the server side approach is the most reliable and would provide a guarantee that the data will persist across any time span as long as the server side data is preserved.
I am developing a website and i am having a problem in finding the best solution to maintain user login session.
Currently i am using Html5 web storage "session storage" to store whether user is logged in or not. But problem in this is that this only works in a single tab not across multiple tabs of a browser.
What should i use either Cookies or LocalStorage or i should maintain server side session and check every times a page loads on server whether the user is logged in or not ?
What is the best solution? please guide me.
I am using Node.js and mongodb in the backend and Angular and jquery in frontend.
First thing you must know is that sessions are made only for server-side not for client side. Second thing, if you want your user to not load everytime, try to save the data in user's cookies also don't think about it will require more time to load on server. Because sessions are only made for security purpose and i guess by storing them on client side you are not using that purpose. Also now major question is how to store them on the server side. Suppose your server goes down now all of your sessions will get deleted. Now to avoid that use some external data store like connect-mongo/connect-redis. redis is faster than mongo but if you want to use only memory store then search for memcached/cookie-sessions/jWT hope this answer helps :)
I'm pretty new to web development and have for most of you trivial question.Where and how to store website progress user did? I mean...for example.We have javascript variable
var a=0;
and
<div id="clickhere" onClick="a=a+1;document.getElementById('clickhere').innerHTML=a">
.Imagine someone clicked on that division once and leaves website.I want him to see displayed number one in that div after returning to website.
You either need a server side to store this data, identify the client by some uid or login and retrive the data on repeated visit. or a simpler solution, use a client side cookie.
If you only want visit data viewable to each individual user, you can use a local storage mechanism. For clients whose browsers support HTML 5 you can use localstorage to store a retrieve the variable between user visits. You could get he JavaScript to set a cookie and then check if a cookie exists per user visit, if it does, increment the visit count.
A more robust solution would be to persist the visit count server side. You can issue a cookie to a user, on each future visit, you can either send the visit data to the server via Ajax, or by form submit. This would then need to be persisted to a database using a server side language such as php, ruby or .net.
I have a static website without any server side languages.
Is it possible to pass some custom values whenever a user tries to login then get the data back when the user successfully signed in and comes back to my website from facebook?
I've read about signed_request, but that requires PHP.
You're essentially asking if Facebook will store data for you.
Unfortunately, the answer is no. You need some kind of mechanism on your server that can match a Facebook user to the data you need stored.
You could use local storage, but that's obviously local to the browser and prone to tampering.
I would like to import data that the user had entered into his profile on a website that I do not control. I don't want the user to hand me his login credentials to grab the data from the server-side (connecting directly to aforementioned website). I would rather prefer the login data to stay on the client's machine: It makes my service more trustworthy and I don't have to process sensitive data.
I thought that this can probably done with javascript without greater hassle. However, given the security risks, it seems to be blocked by browsers. See How to get data with JavaScript from another server?
So I think my question is already answered and can be closed/deleted.
I'm not sure I understand what you're trying to do, but there is no secure way to verify login credentials in a browser client. If you want to check login credentials, you will have to involve a server.
Some data can be stored on the client side, but then a user is tied to a particular browser on a particular computer and can't use the service from anywhere else. In older browsers data is generally limited to what can be stored in a cookie and cookies are not guaranteed to survive for any particular long lasting time frame. In the latest browsers, data can be stored in HTML5 local storage which allows for a little more structured way of storing data, but even then you're still stuck in one particular browser on one particular computer.
Based on your comments, it sounds you're trying to "cache" a copy of the data from web-site A that you can access from client-side code on web-site B on multiple visits to your website. If that's the case, then it sounds like HTML5 local storage may work to serve as a cache storage mechanism. You will have to figure out how to get the data from web-site A into the cache as the cache will be subject to same-origin access (domain X can only access the data that was put into HTML5 local storage by domain X), but if you can get manage to get the data from web-site A into your web-site B client-side page (perhaps using JSONP), then you could cache it using HTML5 local storage. You will need to realize that even HTML5 local storage is not guaranteed forever (so you need to be able to fetch it again from web-site A if required).
You said this
I don't want the user to hand me his login credentials to grab the
data from the server-side (connecting directly to aforementioned
website).
If you do that, anyone would be able to access any User's data, since you don't restrict access to data.
You also said this
I would rather prefer the login data to stay on the client's machine:
It makes my service more trustworthy and I don't have to process
sensitive data.
I'm really not sure that's a good idea. You still need to lock down personal information. But anyway, if you really want to, you can use localstorage -- modern webbrowsers support this.
Check out this link for a primer on local storage.
Storing Objects in HTML5 localStorage
Note that the user can clear the browsers local storage, so you still need to have a form to enter credentials.
EDIT -- if you want to save a user's profile information on the client, you can do that with local storage. But you still need to save the data to the server, else if the user goes to a different machine or even browser, they won't have their data. Plus, your server side model probably needs to associate a user's content with their profile in some way. I don't think there is any way around it.