我正在尝试在 Firefox 4.0.1 和 WindowsXP 中使用 Google Transliterate API helloWorld
我正在使用 node.js 0.4.7 来提供页面
当我通过 node.js 加载页面时,我收到以下错误:“尝试在已清除的范围上运行 compile-and-go 脚本”
如果我双击它并从磁盘在 Firefox 中打开该页面,或者如果我在 IE8、Opera 或 Chrome 中打开它,该页面将成功呈现
知道为什么会发生这种情况以及解决方法是什么吗?这是代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="https://www.google.com/jsapi?api-key-here">
</script>
<script type="text/javascript">
// Load the Google Transliterate API
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
[google.elements.transliteration.LanguageCode.URDU],
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);
// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
control.makeTransliteratable(['transliterateTextarea']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
Type in Urdu (Press Ctrl+g to toggle between English and Urdu)<br>
<textarea id="transliterateTextarea" style="width:600px;height:200px"></textarea>
</body>
</html>