Firefox 4.0.1 および WindowsXP で Google Transliterate API helloWorld を使用しようとしています。
ページを提供するためにnode.js 0.4.7を使用しています
node.js を介してページを読み込むと、次のエラーが表示されます:「クリアされたスコープでコンパイル アンド ゴー スクリプトを実行しようとしています」
ページをダブルクリックしてディスクから 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>