html5 localstorage accessiblity - html

In html5 if I create an new local storage key called mykey from a website www.a.com, will I be able to access mykey from another site, say www.b.com ?
Can any website access the key/value pairs created by other website? Please explain in detail. Even links will do fine.
I created two jsp files both of them using the same local storage and deployed them in jboss as different files. Now both the domains i.e localhost:8080/store1/local_storage.jsp and localhost:8080/store2/local_storage1.jsp are able to access the same key/value pair. How is that possible?

No.
Just like cookies are these objects only accessible from the domain that created them, for security reasons.
If you want to pass data from one domain to another I can recommend a form that posts to another site or put the data in a query string :)

Related

Salesforce Development and configuration

I want to merge 6 different profiles into one, consolidating FLS, Record Type, Permission sets, Page layouts in salesforce. May I know whats the best possible and easiest way to do it?
Thanks
Use the Salesforce Metadata API to retrieve the 6 profiles in xml form. You can then view all the permissions each profile has and consolidate into one. Then use the Metadata API deploy() to deploy the profile to your Salesforce org.
Salesforce give examples on how to retrieve profiles and the required package.xml to include in the request here: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profile.htm
Note: the retrieval content of profiles is relative. i.e to see the profile permissions for Account object, you must include the Account object in your retrieve request.
Salesforce documentation:
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based.htm
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_retrieve.htm

How can I store some data only by a single request to the server and can use on several pages?

I have a dropdown list which is being used on several pages including the Home page. And I don't want to send data requests to the server for that drop-down list for all those pages. I want that drop-down list to be stored somewhere for all the pages at the time of loading the home page.
I could then use that several times on several pages without sending requests to the server each time. So that I could make my site a bit faster. Is there any way to do this?
You can make use of Singleton Service, which can be referred by all the components in your application. Give the server request to fetch data at the start of application, and store the result in the form of properties or attributes declared within the Singleton Service.
Once you have the data within service, you can simply refer that instead of giving server request every time.
Refer here for Singleton Service : How do I create a singleton service in Angular 2?

How to store physical file location of files in MYSQL for a java EE web application?

I have three projects in eclipse for a cloud web application where the user can login and should be able to store files.
Front end(servlets/html/jsp),
Middleware(ejb's),
Backend(MYSQL server)
There is already a working login form connected to the database that authenticates users.
From my understanding, BLOB is not advised and i should be storing the physical file location instead.
I need to store the following information about each file:
file-name,
file-type,
physical-file-location,
webcloud-location
Ideally the user should be able to have access to other users directories if given permission.
So is that achieved in the same manner as implementing a login table that holds user credentials?
How exactly can a user download a file if the database only stores the location of the file?
Where to store.
You are indeed correct that it's advisable to store merely the file location in the database instead of the file itself. The usual practice is to use a unique hashed name when storing the file in the cloud while saving both the unique hash and the original file name in the database.
Sharing
In web applications, user directories aren't the same as user directories on linux. In a web app, they are virtual. What you need is a sharing table that links file ids with user id or group ids.
How to download
This is simply a matter of giving a link to the file as stored on the web cloud. If you have used a hashed name as mentioned above the file name is not guessable by others + you avoid the hassle of writing long lines of code to fetch the file from the cloud to the servlet container and pass through it's content to the user.

creating a subdomain for every user

When a new user signs up, many sites create a new domain, something like newuser.example.com
Does this mean that they have separate directories for every user, and copy the code base into the newly created directories and create sub domains? What is the best way to do this?
Refer here:
When you auto-create subdomains on user signup does it create a new website or gives appearance of a website?
Surely a DNS rule of * -> IP address would take care of adding the subdomains quickly. Then its up to the web server to deal with the different host headers.
I would then create a new Apache directive for each different host header I needed (one for each subdomain) and have them be aliases for real website.
You can setup a wildcard domain *.yourdomain.com and handle the differences within your code if the application is pretty much the same between subdomains. Everyone comes to the same application and you just parse out the subdomain and store it in a variable which can be used to lookup different data in your database and / or render different templates / themes, etc.
I.e. subdomain_fu

Flash Security help needed

I am developing a player and i want to make it for only one domain usage for one download. If user needs again then again hew needs to download another version from my site. How can i make it. Please some one tell me
You have to create a key. a fancy hash of their domain name would do the trick, when a user downloads your app - they enter the domain name and receive a key. OR you can add it to your own databse and ensure your application checks the key everytime the player is run. That way you can see where the app is running from.
If they try to use the player on a domain that is not in your database, or the key does not work - the application can be killed.
So: domain name hash (maybe md5 twice), this is given to the user to add to a config OR you save it and the player talks to your server.