0
我正在使用GWT web應用,想從這個生成器使用Skype URI尤其是生成的代碼:SkypeButton添加Skype的按鈕,HTML面板
我使用HTML面板,因爲它看起來像/就像HTML (見下文)。我已經有了:
EntryClass
@Override
public void onModuleLoad() {
HTMLPanel htmlPanel = new HTMLPanel("<h1>Headline</h1>");
HTMLPanel skype = new HTMLPanel(
"<script type=\"text/javascript\"
src=\"http://www.skypeassets.com/i/scom/js/skype-uri.js\"></script>"
+ "<script type=\"text/javascript\">"
+ "Skype.ui({\"name\": \"call\",\"element\": "
+ "\"SkypeButton_Call_My.User_1\",\"participants\": "
+ "[\"My.User\"], \"imageSize\": 32 });"
+ " </script> ");
skype.getElement().setId("SkypeButton_Call_My.User_1");
RootPanel.get().add(htmlPanel);
RootPanel.get().add(skype);
}
當我運行這段代碼沒有成功。這是編譯後HTML代碼在瀏覽器中的樣子。
開發工具(鉻)
<div id="SkypeButton_Call_My.User_1">
<script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
<script type="text/javascript">
Skype.ui({
"name": "call",
"element":"SkypeButton_Call_My.User_1",
"participants": ["My.User"],
"imageSize": 32 });
</script>
</div>
但是,當我在我的index.html文件使用上面的代碼的JS創建從Skype生成碼驗證碼:
開發工具(Chrome)
<a href="javascript://"
onclick="Skype.tryAnalyzeSkypeUri('call', '0');
Skype.trySkypeUri_Generic('skype:My.User?call', '_detectSkypeClient_1393181312260', '0');
return false;
">
<img src="http://www.skypeassets.com/i/scom/images/skype-buttons/callbutton_32px.png"
alt="Skype call"
role="Button"
style="border:0;
margin:32px;
vertical-align:-41px;">
</a>
我的猜測是我的應用程序沒有執行e生成的JS像web服務器一樣處理index.html。
經過我的研究,我發現主題JSNI suiteable,但我不知道如何將生成的代碼放入我的項目。 :(
有人可以幫助我走出這個問題呢?一個例子或方向將是巨大的:)
THX你的答案,我在哪裏必須把Skype的生成skript注入呢?我必須格式化一個.js嗎? – MarcelHodan
添加要回答的示例代碼 –
謝謝@Thomas Broyer。工作很棒:) – MarcelHodan