Monday, March 10, 2008

HTML5 postMessage()

postMessage() is allow javascript to communicate cross domain. This is very interest feature. There is a simple demo in

With this feature, single sign on and web service can be done in the client. Hopefully, this feature is not going to open new chapter of security issue.

Use CSS to create vertical Text

IE got more simple solution by setting style attribute "writing mode".

.vt {
writing-mode: tb-rl;
filter: flipv fliph;

<div class="vt">Vertical Text</div>

For the rest of browsers, need to use SVG.

<embed class="svgex" src="vertical_text.svg" type="image/svg+xml" frameborder="no" width="30" height="90" />

For svg,

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "">
<svg version="1.1" xmlns="" xmlns:xlink="">
<script type="text/javascript">
//this will create htmljavascriptfunctionname in html document and link it to changeText
top.htmljavascriptfunctionname = changeText;
function changeText(txt){
var newText = document.createTextNode(txt);
// ]]>
<text id="thetext" transform="rotate(270, 90, 0)" font-size="12" x="3" y="-60" font-family="Verdana">Vertical Text</text>

The svg code is modified from
I just make it work, but I think the width/height will change base on content.