gpt4 book ai didi

android - 在 jQuery Mobile 中的应用程序本身中打开一个 Web 链接

转载 作者:行者123 更新时间:2023-11-30 04:14:35 25 4
gpt4 key购买 nike

我想在 jquery 移动 android 应用程序中打开一个 url(例如 www.google.com)。我想在应用程序本身的上下文中打开它。我不想打开不同的浏览器以在单击链接或按钮时启动它。我想在应用程序中打开它。是否可以。谢谢。

最佳答案

找到解决方案 here :

function openInWebView(url)
{
var anchor = document.createElement('a');
anchor.setAttribute('href', url);

var dispatch = document.createEvent('HTMLEvents')
dispatch.initEvent('click', true, true);

anchor.dispatchEvent(dispatch);
}

然后在您的应用中像这样调用函数:

openInWebView('http://google.com')

关于android - 在 jQuery Mobile 中的应用程序本身中打开一个 Web 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10244335/

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