从调用日食的JavaScript的PhoneGap [英] calling javascript from eclipse for PhoneGap

查看:161
本文介绍了从调用日食的JavaScript的PhoneGap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载使用PhoneGap的Andr​​oid上使用以下code网站:

I am trying to load a website using Phonegap on Android with the following code:

   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setBooleanProperty("loadInWebView", true);
    super.loadUrl("http://arriva.com.mt");

}

我将如何执行本地JavaScript文件上的WebView?

How would I execute a local javascript file on the webview?

推荐答案

我是有这个问题,但设法解决它自己到底。在你的活动,你有
super.loadUrl(JavaScript的:yourFunction中()); 您的code内 - 确保你有一个窗范围功能火的 window.yourFunction =功能() 。当你使用PhoneGap的我会认为JavaScript是在web视图已启用。如果没有,你将需要启用过,你可能会发现,用于查找有关我的文章很有用。

I was having problems with this but managed to resolve it myself in the end. In your Activity you have super.loadUrl("javascript:yourFunction()"); within your code -- make sure you have a window scoped function to fire window.yourFunction = function(). As you're using PhoneGap I would assume that javascript is already enabled in the webview. If not, you will need to enable that too, you might find my post useful for finding out about that.

<一个href=\"http://stackoverflow.com/questions/7916624/calling-javascript-functions-in-a-webview-from-activity-class\">Calling在网页视图JavaScript函数从活动类

心连心

这篇关于从调用日食的JavaScript的PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆