This is a mirror of official site: http://jasper-net.blogspot.com/

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

| Sunday, June 19, 2011
You can quickly run HTML in the browser without creating a HTML file:

Enter this in the address bar: data:text/html,<h1>Hello, world!</h1> (This won't work in IE) 

You can make a page's CSS editable in the browser without using JS:
<!DOCTYPE html>
<html>
<body>
<style style="display:block" contentEditable>
body { color: blue }
</style>
</body>
</html>

(This also won't work in IE)

You can have the browser parse a URL for you like this:

var a = document.createElement('a');
a.href = url;

// any property of window.location works here:
document.write('The hostname of ' + url + ' is ' + a.hostname);

Read more: Quora

Posted via email from Jasper-net

0 comments: