使用JavaScript代码iphone应用程序和uiwebview可以访问变量吗? [英] iphone app and uiwebview with javascript code can i access variables?

查看:131
本文介绍了使用JavaScript代码iphone应用程序和uiwebview可以访问变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有javascript的网页,将视图分成用户可见的页面:

i have a webpage with javascript that split the view into "pages" visible to the user:

    <!-- optionally include helper plugins -->
    <script type="text/javascript" language="javascript" src="js/jquery.mousewheel.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/jquery.touchSwipe.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/jquery.ba-throttle-debounce.min.js"></script>

我想知道应用是否可以知道显示的页面...访问某些变量该页面或其他方法来了解它。
我没有编程页面,所以我只问是否概念上可行或者不知道,以及如何知道页面发生了什么,由网页中的事件驱动
谢谢

i'm wondering if the app can know the page that is displayed...accessing some variables in the page or some other method to know it. i've not programmed the page, so i'm asking only if is conceptually possible or not, and what is a way to know what is happening to the page, driven by an event in the webpage thanks

推荐答案

我不确定这样做的任何直接方式。使用一些应用程序特定的自定义网址方案是一个扫描。这个答案接近回答你的问题 - 从JavaScript发送通知在UIWebView到ObjectiveC中

I am not sure of any direct way of doing this. Using some app specific custom url scheme is one wat. This answer comes close to answering your question - send a notification from javascript in UIWebView to ObjectiveC

我也读过关于从javascript代码写入 NSLog 的地方,然后遍历该日志并提取您的Objective-C代码使用的命令和变量。从未尝试过。

I have also read somewhere about writing to NSLog from your javascript code, then iterate through that log and extract the commands and variables to be used by your Objective-C code. Never tried it.

这篇关于使用JavaScript代码iphone应用程序和uiwebview可以访问变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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