构建Windows应用程序与嵌入式浏览器& JavaScript'hooks' [英] Building a Windows app w/ embedded browser & JavaScript 'hooks'

查看:197
本文介绍了构建Windows应用程序与嵌入式浏览器& JavaScript'hooks'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为客户建立了一个PHP / JavaScript网站。然后他们要求我复制它,除非作为一个独立的Mac应用程序。我使用了一个结合嵌入式Web服务器PHP和'WebView'的应用程序 - WebKit Web浏览器的Cocoa-ish版本,我可以嵌入到标准应用程序窗口中。这一切都很好 - 我重用了10000行以上的PHP / JS代码,这节省了几个月的时间,在原生代码中重新实现它。



现在他们想要一个Windows等效。我有理由相信我可以得到PHP和Web服务器工作。我知道嵌入基本的IE功能很容易。



但是...在我的Mac设置中,WebView(通过windowScriptObject东西)让我能够从C ++调用JavaScript方法。例如,我可以从C ++调用JavaScript方法来更新屏幕。同样,我可以设置,以便在浏览器中的JavaScript调用可以触发一个C ++方法 - 我使用这个,例如,让用户点击BROWSE,并使用一个真实的,标准的文件浏览器选择一个文件路径。所以我的问题是,是否有一个基于Windows的嵌入式浏览器设置,让我与JavaScript以这种方式交互?





$ b b

(JavaScript< - WebKit界面在这里更详细地描述: http:// lipidity .com / apple / javascript-cocoa-webkit /

解决方案

也许尝试使用类似Appcelerator Titanium



引用维基百科:Appcelerator Titanium是一个平台
,用于使用Web技术开发移动和桌面
应用程序。
[...]支持基于标准的web
技术:所有平台上的HTML,CSS和Javascript
以及PHP,
桌面平台的Python和Ruby。
集成支持流行的
JavaScript和AJAX框架
,包括jQuery,YUI,MooTools,
Scriptaculous和其他人。



听起来像一个完美的工具。


I built a PHP / JavaScript website for a customer. Then they asked me to replicate it except as a standalone Mac application. I did this with an app that combined an embedded web server, PHP, and 'WebView' - a Cocoa-ish version of the WebKit web browser that I can embed in a standard app window. This all worked great - I got to reuse 10,000+ lines of PHP/JS code, which saved months off of re-implementing it all again in 'native' code.

Now they want a Windows equivalent. I'm reasonably confident I can get PHP and the web server to work. And I know embedding basic IE functionality is pretty easy.

However...in my Mac setup, WebView (via the windowScriptObject stuff) gave me the ability to call JavaScript methods from C++. For instance, I might call a JavaScript method from C++ to update the screen. Likewise I could set things up so that a JavaScript call in the browser could trigger a C++ method - I used this, for instance, to let a user click 'BROWSE' and pick a file path using a real, standard file browser.

So my question is, is there a Windows-based embedded browser setup that would let me interact with JavaScript in this same way?

(the JavaScript <--> WebKit interface is described in much better detail here: http://lipidity.com/apple/javascript-cocoa-webkit/)

解决方案

Maybe try using something like Appcelerator Titanium so you'll be ready when your client says they want it to work on Linux, or iPhone, or Android.

Quoting Wikipedia: "Appcelerator Titanium is a platform for developing mobile and desktop applications using web technologies. [...] Support for standards-based web technologies: HTML, CSS and Javascript on all platforms along with PHP, Python and Ruby for desktop platforms. Integrated support for popular JavaScript and AJAX Frameworks including jQuery, YUI, MooTools, Scriptaculous and others."

Sounds like a perfect tool for the job.

这篇关于构建Windows应用程序与嵌入式浏览器&amp; JavaScript'hooks'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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