存储书签的数据 [英] store data for bookmarklet

查看:61
本文介绍了存储书签的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个书签,它称为Google App Engine应用. GAE应用程序使用我要存储在小书签中的登录信息,因此,当用户第一次单击小书签时,它会询问登录信息,但是从下一次开始,它将自动提供该信息.

I am making a bookmarklet, which calls a Google App Engine app. The GAE app uses login information, which I want to store in bookmarklet, so when user first clicks bookmarklet,it asks for login info, but from next time onwards it automatically supplies it.

推荐答案

小书签直接存储数据的困难在于它只能将数据存储在cookie或localStore中,这两者都属于"当前页面在.这意味着下次您在其他页面上使用它时,它将不再起作用,也意味着您所在的页面可以访问数据,这通常对安全性非常不利.

The difficulty of a bookmarklet directly storing data is that it can only store data in cookie or in localStore, both of which "belong" to whatever page it is currently on. That means it won't work again the next time you use it on a different page, and it also means the page you are on can access the data, which is generally very bad for security.

通常有两种基本方法来处理您的情况.两种主要方式是:

There are two basic ways your situation is generally handled. The two main ways are:

1.)所使用的应用程序使用户使用cookie保持登录状态.登录信息未存储在Cookie中;只有一个会话ID.这就像您返回许多受欢迎的网站时一样,无需再次登录.通常,这些类型的小书签会为用户打开一个小的弹出窗口,其中包含来自应用程序的页面.如果用户未登录,则应用程序会提示用户先登录.实际上,小书签对是否登录一无所知.

1.) The application used keeps the user logged in with a cookie. The login information is not stored in the cookie; only a session ID is. This is like when you return to many popular websites, you don't have to log in again. Very often these types of bookmarklets open a small popup for the user which contains a page from the app. If the user is not logged in, the app prompts the user to login first. The bookmarklet in fact knows nothing about being signed in or not.

2.)每个书签都是为每个人定制创建的.因此,我的书签与您的书签不同.区别只是我的将在代码中包含我的登录信息,而您的将在代码中包含您的登录信息.实际上,我们每个人都必须先登录该应用程序,然后才能获得自己的个性化书签.

2.) Each bookmarklet is custom created for each person. So my bookmarklet would be different than yours. The difference is simply that mine will contain my login info in the code, and yours will contain your login information in the code. In fact we would each have to login to the app first before we can get our own personalized bookmarklet.

通常,选项1更好,更简单,更安全.

Generally, option 1 is better and easier and more secure.

这篇关于存储书签的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆