【问题标题】:How to get the current page URL using GWT in a Chrome extension?如何在 Chrome 扩展中使用 GWT 获取当前页面 URL?
【发布时间】:2014-05-07 15:11:06
【问题描述】:

我正在使用 GWT 开发 Chrome 扩展程序。打开扩展程序时,我必须获取页面的 URL。我必须这样做,因为我需要读取页面内容来获取一些数据。

有什么想法吗?

谢谢。

【问题讨论】:

    标签: java google-chrome gwt


    【解决方案1】:

    尝试使用GWT.getModuleBaseURL()GWT.getModuleName()GWT.getHostPageBaseURL()

    查看GWT 类中可用的其他方法。


    DEV 模式下的输出:

    GWT.getModuleBaseURL(); 
    GWT.getHostPageBaseURL();
    GWT.getModuleName(); 
    

    输出:

    http://127.0.0.1:8899/gwtproject/
    http://127.0.0.1:8899/
    gwtproject
    

    【讨论】:

    • 谢谢,但它不起作用。它返回 chrome-extension://fllkecojollgpdflndacmfcl.... 我需要它返回我打开扩展程序的网页的 url。
    • 我对 Chrome 扩展一无所知。我只知道如何在 GWT 中获取它。
    猜你喜欢
    • 1970-01-01
    • 2016-09-28
    • 1970-01-01
    • 1970-01-01
    • 2011-09-21
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    • 2015-12-27
    相关资源
    最近更新 更多