Turn browser into notepad with one line of code
This is the code shared by Jose on codewall. When you type data:text/html, into the address bar of the browser and press enter, the browser will turn into a notepad which you can edit.
Why it works?
This uses Data URI’s format and it tells the browser to render HTML. But contenteditable is a property of HTML5, so this can only work in the web browser which supports this property.
Here are some interesting contents.
Some people make some changes to the code encouraged by the idea of Jose.
- jakeonrails wrote one line of code which supports Ruby code highlighting. Here is the code:
data:text/html,
- slawdan reminds that if we change
ace/mode/ruby toace/mode/python. Then the editor will highlight Python codes.You can do similar things for other languages. - You can use textarea and make it “invisible” if you want autofocus.
data:text/html, <textareastyle="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none"autofocus />
- The following code will change the background color when editing, when stopping editing, the background color will be white.
data:text/html, <html><head><linkhref='http://fonts.googleapis.com/css?family=Open+Sans'rel='stylesheet'type='text/css'><styletype="text/css"> html { font-family: "Open Sans" } * { -webkit-transition: all linear 1s; }style><script>window.onload=function(){var e=false;var t=0;setInterval(function(){if(!e){t=Math.round(Math.max(0,t-Math.max(t/3,1)))}var n=(255-t*2).toString(16);document.body.style.backgroundColor="#ff"+n+""+n},1e3);var n=null;document.onkeydown=function(){t=Math.min(128,t+2);e=true;clearTimeout(n);n=setTimeout(function(){e=false},1500)}}script>head><bodycontenteditable style="font-size:2rem;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">
Source : http://blog.jobbole.com/32823/
By clicking the "Mark as important" button, this article will be put to your important article list which you can find in "Amin->Article important list". Later when you want reread this article, it's easier for you to find it by checking the "Article important list".
Tags:HTML5, Browser editor Read(1145) Comment(0)
Previous : CSS DIV position analysis Next : 52.4 million tablet shipments in Q4 globally
::Related Articles
::Comment Zone
No comment for this article.
::Comment
:: Other versions
No other versions available yet.
:: Recent articles
- Huawei is open to acquire Nokia
- HTML Email Guide
- Use of Erlang in WhatsApp
- Write high quality JavaScript and CSS with SublimeLinter
- Is Facebook developing RSS reader?
- About tmpfs
- Differences among Enter,F5 and Ctrl+F5 in webpage refresh
- China to expand 4G network across the country
- Yahoo is going to recycle inactive user IDs
- The big four in Taiwan can compete with Samsung
- more>>
:: Most read
- TIOBE : C overtakes Java as the No.1 programming language
- Sony is to release PlayStation4 in 2015
- Which programming language should I learn first?
- Disposable Email address
- 5 Free Open Source Chat Applications For Developers
- Never ever touch a programmer
- Hacking Vs. Programming
- TIOBE : Where is that next big programming language?
- Multitasking vs multiprogramming
- Google is developing advanced programming technology to simplify Web application development
- more>>
:: Most commented
- Hacking Vs. Programming
- Which programming language should I learn first?
- Error handling style in C
- 10 controversial programming opinions?
- C vs Java Complete Comparison
- Google+ is sick
- Disposable Email address
- Unix Philosophy
- Some tricks on PHP session
- A C++ program puzzle
- more>>
:: Contribute
Write article:: Find us
