我正在尝试创建一个扩展来使用谷歌翻译来翻译网页。我像这样撰写网址:url google translate + current tab + &sl=auto&tl=it&hl=&ie=UTF-8
但不起作用。怎么了?
谢谢
<script>
safari.application.addEventListener("command", performCommand, false);
function performCommand(event) {
if (event.command == "translate") {
var currentTab.url = safari.application.activeBrowserWindow.currentTab.url;
var rUrl = "http://translate.google.it/translate?u=" + encodeURIComponent(currentTab.url) + "&sl=auto&tl=it&hl=&ie=UTF-8";
safari.application.activeBrowserWindow.activeTab.url(rUrl);
}
}
</script>