Are*_*iak 2 browser gwt window new-operator
我有GWT模块,我做了一些东西,我有搜索结果 - 无论以哪种形式.现在在搜索并点击例如"导出到HTML"按钮之后,我想创建新的html页面(例如通过创建简单的字符串来创建简单的字符串,其中仅包含搜索结果列表的列出结果)并打开它新的浏览器窗口.我知道有Window.open(...)方法,但我必须指定我没有的url.我想通过客户端创建这个新的html页面 - 没有服务器推断(我不想在服务器端创建一些资源,然后将url粘贴到此资源到客户端).有没有可能实现这个目标?如果没有选项,其他方法会让我满意,就是打开标准对话框进行保存,这样就可以将结果保存到html文件中.
谢谢你的帮助.
亲切的问候.
这是我用来打印的代码:
native void openPrintWindow(String contents) /*-{
var printWindow = window.open("", "PrintWin");
if (printWindow && printWindow.top) {
printWindow.document.write(contents);
printWindow.print();
printWindow.close();
} else {
alert("The print feature works by opening a popup window, but our popup window was blocked by your browser. If you can disable the blocker temporarily, you'll be able to print here. Sorry!");
}
}-*/;
Run Code Online (Sandbox Code Playgroud)
好像你可以通过一些简单的重写和删除对print()的调用来适应你的目的!该contents变量只包含平坦的HTML.没有去过服务器的旅行.
openPrintWindow("<h1>Search Results</h1><ol><li>etc...");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2068 次 |
| 最近记录: |