Posts

Showing posts with the label data

Simulate Script Injection Via Data URI

Well, not only downloads on the fly , the data uri works for almost everything ( only iOS 5 beta does not want to work with inline data uri AUDIO sources .... but this is another story ... ) ... so ... How To Simulate Script injection Let's say you want a test but you don't want to bother a server. However, you want to be sure the test is asynchronous and it simulates the server. var head = document.getElementsByTagName("head")[0], script = document.createElement("script") ; head.insertBefore(script, head.lastChild); script.src = "data:text/javascript;base64," + btoa( "alert('Hello World')" ); How To Simulate JSONP Same trick, isn't it? ... except: script.src = "data:text/javascript;base64," + btoa( "callback(" + JSON.stringify(dummyData) + ")" ); How To Drop Server Requests well, this is the tricky one ... Surely there is some job to do in the createResponse() function but ... he...

On element.dataset And data-* Attribute

Why on earth? I mean why we should put a data-whatever attribute into our layout? Where is the good old MVC? How can you consider data-* more semantic? more semantic than what? Why we would like to kill truly semantic pages and graceful enhancements? Why we need JavaScript redundant info inside nodes attributes but we cannot understand a script tag in the middle of the page? Why in the performances matter era we would like to let users download stuff that they will probably never use? What Am I Talking About We can find the " magic " data attribute description in the W3C Semantics, structure, and APIs for HTML documents page. These days there is a page that is going around even too much ... finally somebody realized that this data- thingy is nothing different than what we could have always used since ages: XML . Why We Are Doing Wrong If we are enthusiast about a custom attribute able to bring whatever information, we should ask ourself why on earth we are not using simp...

Inline Downloads with Data URLs

A quick post about another silly idea ... With Data URLs we can incorporate images in layout or CSS . The schema is really simple: data:[<mediatype>][;base64],<data> Since we need to specify a mediatype we could play around creating something unexpected ;-) My Silly Idea If we select something in a web page we can perform different actions via right click. So far so good ... but one thing we are missing, at least in Firefox, is a "Save As" option. If we want bring a piece of code, text, something else, into another software or editor we need to select, right click, copy, open or find the editor, right click, paste. The ultra skilled developers goes well with ctrl+c and ctrl+v but there are still 3 operations to do: copy, find the destination, paste What about making possible to simply save that part and go on reading or surfing in order to do not distract too much our lecture and review eventually later that piece of text or code? Firefox Inline Download function ...

Internet Explorer Security Hole - A Better Example

Again, about the security hole I talked about last posts, but this time with a really simple example . How does the example work Open Internet Explorer, whatever version Go in this page Write a fake user name and a fake password, or a fake email address and a password Click Submit What does the example do Emulates user actions via javascripts with some version of IE, it could be able to grab both fields values in any case, it demonstrates you that every site could steal your compiled fields in every other site, if the autocomplete option is not forced to be disabled What could do a malicious, and hidden, code steal your data steal your email steal your credit card information (a really famous company, as example, suffers this problem, so somebody could steal credit cards details of million of people) steal your details steal your searches via common search engines etc, etc More details in my old post I wrote last Saturday , the one th...

Security Basis, and an Internet Explorer data stealer

It has been about 4 years, or more, that I know about this problem, but for some reason I did not talk about it, scared by possible reactions. In other words, I was waiting for some noise over the net, or some fix from Microsoft, but nothing is happening. Actually, Microsoft is working hard on Internet Explorer 8, but the problem I am talking about, is still present ... so, I suppose it is time to tell you how dangerous this IE "feature" could be, and how dangerous could be to forget a little detail in a form, like the autocomplete attribute. The magic autocomplete option Every browser tries to make our net life as simple as possible, and when we start inserting data in an input field, it suggests us a couple of words or, if the name of that field is unique enough, directly the most probable word, name, or number, we are going to insert. To perform this operation, we could start typing the name, or simply use the down arrow button to open the list of options, and choose, usu...

IE8 Beta 2 - inline images, and anything else

With IE8, we finally can "play" with inline images, specially for CSS or other little decorations. The main limitation is that the length of the data protocol has a maximum fixed length, but even worst is that IE8 apparently introduced the data protocol only for images. In another scenario,where we would like to use the same technique for other purposes, IE is still the only browser that does not respect standards. This is an example: function evalazy(src, callback){ var script = document.createElement("script"), body = document.documentElement; if(callback) script.onload = callback; script.type = "application/javascript"; script.src = "data:" + script.type + "," + encodeURIComponent(src); body.removeChild(body.appendChild(script)); }; Above function is able to evaluate valid JavaScript code in an asynchronous way, calling a callback, if any, when evaluation has been completed ( kinda load runt...