Do Windows 8 apps run on standards-compliant JavaScript, HTML5, and CSS3? - javascript

Like most .NET developers I was watching the keynote for the Build Event in Anaheim, Cali and had a questions about the new support for building applications for Windows 8 using JavaScript, HTML5 and CSS3.
They showed quite a few examples and even said the new Windows 8 marketplace was written using these technologies. The only thing that kind of has me guessing is when they put JavaScript in the same category of C#, in the sense that you could program your windows apps (have access to .NET directly) using JavaScript.
Obviously being a web developer this was pretty awesome news considering some of the applications I've built using JavaScript, HTML5 and CSS3.
The question I have is whether or not the applications we build for Windows 8 are truly web compliant? Can we build apps for Windows 8 and turn around and launch them on the web? Can web applications that are currently online access some of the features they demoed?
Like I said this would be an awesome advancement. Not to put down Silverlight, which I have written quite a few applications for, and the way it works in blend rocks. And the thought of replacing JavaScript with some of my apps that are written in C# is not even an option.
Is this just to get "web" based developers to develop for Windows or is this a cross platform solution for building applications?

Slight clarification, the Javascript/HTML5/CSS3 windows programs run on a new layer called WinRT (Windows Runtime), not .Net. All of the new Windows Metro style apps will be built on top of this layer rather than the older .Net. If your app utilizes the WinRT features, obviously you would need Windows to run the app. It is your choice if you want to integrate those features. (Obviously it depends on what you are trying to do with your app) I believe you can build an all standards compliant app and have it run on the system just fine - you just won't be using any MS specific features. In that sense, it would be like a webpage that you launch as an app.
Other notes:
MSIE currently uses some -ms specific prefixes until those features are accepted by W3C and given official cross browser names. Not unlike -webkit-border-radius,-moz-border-radius and border-radius.
The HTML5 uses some features such as grids that are not yet implemented in most browsers.
Microsoft includes a lot of Javascript libraries to make it easy to build apps. Many of these are jQuery based. Some are Windows specific. Not sure what the licensing is to use them elsewhere. I assume the jQuery is allowed to be portable whereas the Windows ones, wouldn't make sense to use outside of WinRT.

#Matt
To clarify the "converse", standard web app written in HTML5 running as a Metro application:
Assuming your application isn't doing "Bad Things" then yes. The Metro app environment is restricted by default. In order to access non-local resources (e.g. a website) from within the application in HTML5/JS, you must create what is known as a "Web Context".
The Web Context allows an application access to the internet and unsafe resources while preventing that same context from accessing privileged resources, like the Windows Runtime APIs.
This ultimately means that if you need to host a Bing Maps widget and want to get GPS information from the system, you would need the following:
an iframe inside the page (which is Local Context by default) hosting a Web Context that contains your Bing Maps widget
use window.postMessage to send data between the Local Context and the Web Context (contained in the iframe)
Call the Windows Runtime API for accessing the GPS location of the device from the Local Context mentioned above
This application model affords you the security that no website opened inside the JS application will have rogue JS executing Windows Runtime APIs to scrape your data. This is probably the biggest area that you will have to re-architect in an existing web application to get it running as you must push data between contexts if it comes from an unsafe resource.

Short answer is no -- apps built using the WinRT stack won't be able to run in a "normal" browser. I'm not sure about the converse though -- if a standard web application written with HTML5 can be run as a Metro app.

Related

LOB Desktop applications using HTML5, CSS, Node.js, Chromium Embedded Browser

With the tremendous progress going on with web technologies, does it make sense to bring these to desktop and client-server applications.
We typically build our applications using winforms and wpf and the code base is like 100k+ lines of code.
Is it worth exploring the option of HTML5 UI and Node.js backend and use a framework like the chromium embedded framework or node-webkit.
The reason I am asking this is that the support from Microsoft for the desktop technologies is questionable (wpf, metro apps ...).
At least with the technologies I listed, it is easy to port to make the application work across all platforms and companies like microsoft and google are pushing for html5 and javascript.
A number of companies are using CEF and similar web-based technologies for desktop applications.
Steam from Valve is CEF based (https://developer.valvesoftware.com/wiki/Chromium_Embedded_Framework), as is
Spotify https://community.spotify.com/t5/Help-Desktop-Linux-Mac-Windows/Chromium-Embedded-Framework/td-p/912377 and
Adobe Creative Cloud (I believe using Adobe Brackets Shell over CEF and incorporating Node.js) https://github.com/adobe/brackets-shell
Advantages for them are that server side content can be delivered to the application, as can UI updates, and the client machine is fully accessible.
We are using it for product authorization and delivery, the advantages of CEF for us are dynamic update from the server of both UI and business logic in Javascript, and because CEF allows calls from Javascript to C++, we can access files on disk and Registry entries that pure Web code cannot.
So I would recommend looking into this.
For ordinary Line Of Business applications, I would suggest no, don't go half-way.
I used to do advanced UI development in WPF, and it was amazing for its time (a decade ago), but nowadays it is really amazing what can be done all within a modern web browser. And yes, Microsoft's support of full-powered desktop technologies is like a ghost town (I suspect they just want to get their 30% commission on apps in their store, so they've shifted focus to UWP).
Why do you need to create a hybrid desktop/web application? Unless you have a specific (and important) need to break out of the browser's sandbox, why not go all the way and create a web application? Modern browsers have a lot more capabilities now, and they keep getting better.
There are also many technologies and frameworks that really help to make large-scale web application development a lot easier than it used to be.

Can a web application be converted to a google chrome application?

We have a very simple digital signage application that loads six web pages and rotates through them in an iframe.
We thought we would like to take this application and run in kiosk mode as a chromium app. However, simply using the HTML in the page has thrown all kinds of errors for the app. The most consistent on is the illegal use of external images, css, and fonts as well as complaints about javascript libraries, etc.
It looks as though it will be extremely painful to try to make this into a kiosk app.
Is it possible to make this type of conversion?
Does anyone have advice as to how to proceed?
Can you pull in external pages into a Chromium app?
You cannot run Javascript on a browser via local filesystem for security reasons. But what you could do is package the web app as a local app.
One option is to use Windows HTML Application (HTA)
http://en.wikipedia.org/wiki/HTML_Application
But this requires Internet Explorer to run.
Another option that sounds great is using Node Webkit. I have never done it before, but seems very powerful.
https://www.npmjs.com/package/nodewebkit
You can write a powerful Javascript app and run it locally this way.
UPDATE
Official Node Webkit website:
http://nwjs.io/

Combine browser and web app for deployment

What's the best way to turn an HTML/Javascript web app into a self-contained app that can be run from Windows (and maybe Mac/Linux) PC's? Preferably without any installation, ie a network share.
I have looked into Chrome and Firefox Portable, but these require write access to the folder, so are unsuitable for running off a read-only network share.
(some background, I have a big javascript app but many of my clients are using IE6 or 7. Their IT teams won't allow Chrome Frame, or other modern browsers).
node-webkit sounds most promising.
From the README on the github repository:
node-webkit is an app runtime based on Chromium and node.js. You can
write native apps in HTML and Javascript with node-webkit. It also
lets you to call Node.js modules directly from DOM and enables a new
way of writing native applications with all Web technologies.
If LightTable can be built with it, certainly a web application can be ported and run natively using it.
I know this is a bit late, but what about Sencha Desktop Packager?
http://www.sencha.com/products/desktop-packager
It was primarily developed for ExtJS apps, but it should work on any JavaScript app.
We had a similar requirement and ended up building a dedicated web browser using QT. However if we'd known about the Sencha Desktop Packager before we may have gone for that.

Desktop application development with Javascript and HTML

I am looking for Titanium Appcelerator alternatives for Desktop application development with HTML and JavaScript. I want to convert a web app to a desktop application. Hence, there will be a lot of server interaction. Appcelerator was a good choice, but it looks like the company is no longer interested in the Desktop SDK. Also, ajax request from Appcelerator does not retain cookies.
I read that Adobe Air can be used for desktop app development, but I don't want to use flash.
How good is XULRunner? Will it allow features like Growl notificaiton and creating tray icons?
Will I be able to develop applications using mostly Javascript and HTML in Qt?
I started looking into Titanium for desktop dev. I liked the concept but not the implementation. I then stumbled upon chromiumembedded and have been mostly very happy with it. It's basically a web browser control based on chromium.
http://code.google.com/p/chromiumembedded/
It's written in C++ so you can do all the low level OS stuff you want(Growl, tray icons, local file access, com ports, etc) in your container app, and then all the application logic and gui in html/javascript. It allows you to intercept any http request to either serve local resources or perform some custom action. For example, a request to http://localapp.com/SetTrayIconState?state=active could be intercepted by the container and then call the C++ function to update the tray icon.
It also allows you to create functions that can be called directly from javascript.
My biggest challenge has been debuging. It's very difficult to debug javascript directly in CEF. There's no support for anything like Firebug that I am aware of.
Appjs (appjs.org) looks very promising.
You could also check Bowline which is another alternative: http://bowlineapp.com/.
Although it's not officially intended for general-purpose use, a number of people have had success using brackets-shell for HTML/JS desktop apps. It embeds Chromium (CEF) and adds APIs for menu bar management and file IO. It also embeds an instance of Node.js so you get access to all its APIs for launching processes, etc. It's MIT-licensed and available for Mac & Win, with a Linux version currently making rapid progress.
As I mentioned, it's not officially a general-purpose app shell, but someone wrote a detailed blog post about how to customize brackets-shell for your own uses.
I notice that the other answer about Titanum says CEF is hard to debug. I'm not sure if that's true in Titanium, but in brackets-shell it's easy to debug JS – you just open http://localhost:9234/ to load a full instance of the Chrome Developer Tools (including breakpoints, profiling, etc.).
TideSDK is a continuation of the old Titanium desktop http://www.tidesdk.org/

Developing Windows apps with JavaScript

I'm currently in the need of developing a Windows application. I want to keep things simple (in the spirit of uTorrent) and I would like the result program to be a single .exe file containing all that it needs.
The program is simple. It just needs some UI. It needs to run for a long period of time (lay there as a tray icon). It needs to do some routine tasks like simple I/O. It also needs to access the internet, specifically some web server.
Apart from these small requirements I would like to write all of it in JavaScript, as I feel more comfortable with it than any other language.
I know there's things like Windows Script Host that let you run JavaScript programs and interact with some Win32 API, but will I be able to do everything I need with Windows Script Host? Can I pack all of the Windows Script Host in a single .exe?
If not, what alternatives do I have for JavaScript?
I found that there's actually a JavaScript compiler that comes with the .NET framework called jsc.exe.
For more information:
http://www.phpied.com/make-your-javascript-a-windows-exe/
http://msdn.microsoft.com/en-us/library/7435xtz6(VS.80).aspx
I guess it's not really JavaScript since it introduces extra things like import and even some class syntax which is weird for me. But this works perfectly for me as I will just doing things as I am used to on the web.
Aside from Windows Script Host, there are
Windows Desktop Gadgets (Vista and Windows 7 only)
HTML Applications (HTAs)
Both are written with standard web technologies, HTML, JavaScript, Flash, etc. They can also be extended with COM objects/ActiveX controls such as FileSystemObject, WMI, WScript or even ones that you write yourself. Windows Desktop Gadgets have access to a separate API/namespace with various Win32-esque properties and methods.
It seems that nobody mentioned JSDB.
JSDB offers a command line environment which you can execute arbitrary javascript code. You can easily compile to a .exe file by using the command copy /b jsdb.exe+program.zip program.exe
It's important to know that you've got to call your main js file main.js within a standard zip file. Not sure if the name program.zip is required.
I haven't actually tried making GUI applications with this yet - although it seems to support various APIs like ActiveX.
It's possible that by using the copy /b command mentioned above, you could compile a script from the wscript.exe file - but I tried and couldn't get it working. Let me know if anybody tries and has success somehow.
I think you're looking for Adobe AIR
The Adobe® AIR® 2 runtime enables developers to use HTML, JavaScript, Adobe Flash® software, and ActionScript® to build web applications that run as standalone client applications without the constraints of a browser. ~ The AIR website
Internet Explorer introduced the concept of Hypertext Applications in IE 5. It never made a big breakthrough, so resources and documentation are scarce.
Mozilla-backed competitor Prism seems to be alive and well, though, and is definitely worth a look.
Prism is an application that lets users split web applications
out of their browser and run them directly on their desktop
I believe the best way to go is V8 JavaScript Engine provided by Google.
"V8 can run standalone, or can be embedded into any C++ application." - which I believe is perfect for your needs, because you can do most of the stuff in JavaScript and use provided interfaces to communicate with the system.
I'm not 100% but I believe WSH uses JScript or WScript, not JavaScript.
Color me crazy, but its only a short step form Javascript to Java or C#. I'd suggest C# as, on a windows machine, the libraries are already there. You can just copypaste your .exe and let 'er rip.
If you want a single .EXE, what runtimes are you okay if they are required pre-requisites?
If you're okay with requiring .NET runtime to be preinstalled, then you do all your work in JScript.NET
Chromium Embedded Framework (CEF) may give you some help. i have not clearly know how, but i realy found many Apps using this framework.
http://code.google.com/p/chromiumembedded/
Introduce for CEF are:
The Chromium Embedded Framework (CEF) is an open source project founded by Marshall Greenblatt in 2008 to develop a Web browser control based on the Google Chromium project. CEF currently supports a range of programming languages and operating systems and can be easily integrated into both new and existing applications. It was designed from the ground up with both performance and ease of use in mind. The base framework includes C and C++ programming interfaces exposed via native libraries that insulate the host application from Chromium and WebKit implementation details. It provides close integration between the browser control and the host application including support for custom plugins, protocols, JavaScript objects and JavaScript extensions. The host application can optionally control resource loading, navigation, context menus, printing and more, while taking advantage of the same performance and HTML5 technologies available in the Google Chrome Web browser.
Numerous individuals and organizations contribute time and resources to support CEF development, but more involvement from the community is always welcome. This includes support for both the core CEF project and external projects that integrate CEF with additional programming languages and frameworks (see the "External Projects" section below).
Why not use Rhino -- JavaScript on the JVM? You can even compile your scripts to .class files and package them into a JAR along with Rhino for easy distribution...

Categories

Resources