Battery Life

Updated Battery Life to have a battery like power bar appear to the right of the screen where a scrollbar might be. The app was written to help get users of the device to notice how much battery life was left and prompt them to plug it in before they lose all their work. Well, it didn’t seem to make any difference to some people (you know who you are) so I needed something to appear on the screen every couple of minutes and keep reminding them of the battery life remaining. It’s only a small improvement but I think it’s quite handy when you’re on battery power and just need that little extra reminder.

JSONP or CORS – cross domain requests

Just been reading up about JSONP (JSON with Padding) and how you can use it to get cross domain requests to work. This is normally not allowed in browserland because of XSS (Cross Site Scripting) attacks, so I found it interesting that JSONP has managed to work some magic around this. It’s not a magic bullet because it has its own security implications – mainly because it executes a function on your client with the data that comes back from the remote server. That may not be a good idea if you don’t totally trust that server or it has been compromised. That’s where CORS comes in. CORS (Cross Origin Resource Sharing) allows other HTTPRequest types too, like PUT and DELETE so it’s a bit more flexible than the GET of JSONP. One to remember next time you need to do some cross domain access.

Links:

http://en.wikipedia.org/wiki/JSONP

http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS