gpt4 book ai didi

gwt - 在 GWT 中嵌入 google-plus

转载 作者:行者123 更新时间:2023-12-02 05:32:35 26 4
gpt4 key购买 nike

我正在尝试将 Google-Plus 嵌入到我的 GWT 应用程序中。我希望将它嵌入到 Horizo​​ntalPanel 中。我读过+1button developers google .我没有在 stackoverflow 中找到关于这个特定问题的任何帖子。我的问题可能是我不明白如何将 js 包含到 GUI 组件中。我将不胜感激如何将 Google+ 代码添加到面板中的示例。

最佳答案

方法如下:

文档:

 <!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone></g:plusone>

在 GWT 中:

private void drawPlusOne() {
String s = "<g:plusone href=\"http://urltoplusone.com\"></g:plusone>";
HTML h = new HTML(s);
somePanel.add(h);

// You can insert a script tag this way or via your .gwt.xml
Document doc = Document.get();
ScriptElement script = doc.createScriptElement();
script.setSrc("https://apis.google.com/js/plusone.js");
script.setType("text/javascript");
script.setLang("javascript");
doc.getBody().appendChild(script);
}

关于gwt - 在 GWT 中嵌入 google-plus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12183263/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com