Dojo Build for Rhino and browser environments - browser

is it possible to have a dojo build that works fine with rhino and browser environments.
I'm in need making server side export of dojo charts and for the server side dojo charts I'm using rhino.

This question is not very specific. The dojo build can run in node.js and rhino environment. But I assume you need a browser to run a dojo application, no matter if it is built into a 'layer' or not.
Of course -- due to the extensible nature of the dojo build system, you could do some hacks like replacing certain patterns in your code to fix some specific issues.
Maybe you could be more specific about your scenario.

Related

Has Node JS anything to offer for the UI?

Hope I'm not being to general but: I have been tasked with the job of "rejuvenating/modernizing" a monolithic Java EE (JSF/CDI/EJB/JPA) app. Since the requirements state that it should support multiple clients, I have split up the code in a server (JAX-RS interfaces) and a client part (not yet done)
The server is pretty straightforward but I'm wondering about the UI part. Nowadays (hope I don't sound too oldskool) various Node JS spin-offs seem to be popular but I'm under the impression that they have the most value to offer in the "scalable server" section. Does the various Angular/React/Node framework have anything to offer for the client if you have something more complex than a single page app?
It appears to be a really hard time to pick a UI technology nowadays. Sure, the server/DB part which contains most of the business logic are pretty future-proof but still, one would like to focus on one UI technology. There are various jQuery-based frameworks like Kendo, Vaadin & co etc. One option would be to stick with JSF + ICEfaces/PrimeFaces and just work with the REST interface. And then there is JavaFX which looks nice but the future looks a bit uncertain.
So. If the backend is not going to be Node JS, does Node JS have anything to offer for the UI part that can't be done more easily with other frameworks and does anyone have other insights on the UI layer in general. Predicting is hard, especially the future ;-)
Node.js is a way to run javascript on the server side, not client side. That said, npm (nodes package manager) or its wrappers (like bower) are quite often used to manage the client side dependencies - which is very useful to have.
Angular and react (among others) are client side javascript ui frameworks to help make writing ui much nicer. Neither depend on the backend being written in node.js and can work with any rest api (or other server side apis) - or no api at all if that backend injects all the data the page needs into the page itself.
Electron, which combines NodeJS and Chromium (render Process).
https://electronjs.org/
Formerly known as atom shell it was created by Github, it is the core of the Atom Editor, VS Code, Slack app, and a ton of “thick client” applications. https://en.m.wikipedia.org/wiki/Fat_client
There are several implementations which allow you to use Node.JS modules on a client-side (ie. web browser). You can then use html/css and call Node.JS modules directly from your DOM which is used to implement UI.
I'm most familiar with NW.js which I've used couple of times. Others would be for example Electron or AppJS

Can airbnb's hypernova tool be used for angularjs web seo?

Now Airbnb have a tool Hypernova for server side rendering of javascript views. I would like to know if it can be used for enhancing SEO of Ajax based website like the tool Prerender is used for. If not then why?
A quick way to figure out the way how a tool works is to check its dependencies. It doesn't contain phantom or other adapter for headless browser, so it just evaluates client-side scripts in Node.js.
hypernova runs client-side scripts in Node.js and renders them to HTML. In order to make this possible, scripts should be universal and don't depend on browser-specific features. This allows to avoid the overhead that is caused by rendering in headless browser (like Prerender does).
hypernova documentation is focused on using React components because they are naturally universal and most time don't require real DOM when being rendered in Node.js, They are rendered with hypernova-react package, which is a thin wrapper over React's own SSR features.
AngularJS was developed to run in a browser and relies on real DOM. It is guaranteed to work properly only on client side. It's possible (at least in theory) to render AngularJS application in Node.js with DOM emulation (jsdom) or jQuery emulation (cheerio), but hypernova doesn't offer a suitable adapter for that.

Node-webkit: using the same codebase for web- and desktop application

I was given the following to consider:
Develop desktop application using Nodeweb kit.
Also develop web application using the same code base.
Applications should look identical.
Both apps must use the same code base. The reason for this is to cut down development expenses.
If it was up to me I would not even consider using node-webkit for desktop. There are far better desktop solutions for Win platforms. For web application using Node is certanly viable.
But people who plan the project somehow think Node is a way to go for both apps.
After lots of thinking, I came to the conclusion that doing what they want will only increase dev and maintenance costs.
I consider using express (maybe even Sails.js) for web application. I made some tests where I used express on node-webkit and it run just fine.
Certanly NW is powerfull platform (popcorn). Just in my case I fail to see how can it cut down the dev expense
Am I right to be against this solution? Is this a plausible decision and I am not seeing another solution?
Any opinion is very welcome
I have actually done exactly this, and it worked very well. The trick was to write some Node Webkit code that will "detect" that it's running as a desktop application, instead of a web app, and thus integrate with desktop notifications etc.
Yes, it was more work than just writing a web app, but it was also less work (and maintenance) than developing separate applications. You get to use a lot of common code, because of the fact that you are running in a browser already, that I feel the project saved a lot of time.
In fact, I am currently working on another application that requires some desktop features (file access, notifications) but the same functionality as the web application, and I'm proposing that the development happens in Node Webkit.
The important criteria here for me is that both applications are 90% the same, the desktop just adds things you don't normally have on the web. So the core of the application is exactly the same AngularJS application, with some JavaScript injected by the Node Webkit startup page to add the required desktop behaviour.
You haven't presented reasons why you think node-webkit is not a suitable option for desktop application.
On the other hand I think client's opinion that development in node and node-webkit will be able to cut down costs is not ungrounded.
nw.js (formerly node-webkit) is basically a Chromium browser with intergrated node.js engine. So if you develop a web-application using node.js (and any of its frameworks) then you will be able to reuse it in nw.js fairly easy.

How to build an shipable, "local", branded mini-browser

Since I don't really have a good idea for word to search with myself I’d like to ask you:
Is there some project, technology, w/e that enables you to build a 'browser' with a very slim ui. Just some CI and a customised "starting page".
I'm thinking of something like the Webkit engine (and interface) Valve/Steam uses for it's clients store page.
In what direction should I search for something like that ? How would one start implement something like that ?
Answers to questions:
We need this to provide something like a "Kiosk" application (for touchscreens) and shippable to our Customers. Running a browser in "full screen" is a temporary solution.
As of Platforms: Windows is absolutely sufficient for now, but Mac/Linux wouldn't hurt.
Prism looks nice so far but lacks the "shippable" part, e.g. I see no way of packaging it.
Take a look at Mozilla Prism. It's a "UI-Less" version of the Mozilla/Gecko rendering engine aimed at deploying web apps on the Desktop. It's also multi-platform. It might be fairly close to what you need, with comparably little work.
WebKit has bindings for many languages, is cross-platform, and is full-featured as a HTML engine. A bit of work capturing signals and calling functions will make it into any kind of web browser you like.
You could use Adobe Air, follow this tutorial and include your website within an iframe. That would allow you to build an executable you can ship to your customer.
Various graphics toolkit libraries contain some components which can display a limited amount of HTML. I've seen this in qt (a C++ GUI library) and in Java Swing, and have indeed built a tiny "browser" in Java within a couple of hours. Java Swing lets you attach a link listener so links can be made clickable and thereby jump to different URLs. Thus, my application could be made to work as a very limited browser.
This approach lets you display text, images and links; in the case of Java, there's even fairly good support for CSS styling. However, there's no simple way to make buttons and form fields work, and of course no support for manipulating the DOM or anything else done in JavaScript.

Running C# app inside browser as a plugin

I have a small 2D game engine written in C#, using DirectX. Is it possible to somehow run it in a browser as a plugin? Like for example Flash and others, where you go to a site with a game and it will ask you to install a certain plugin and then you can play the game in the browser, with mouse and keyboard input.
I have searched around for hours and I still don't know what I'm looking for. I have so far primarily focused on Internet Explorer, but there are plugins, addons, extensions, etc I don't know what I need really.
Yes I think it is possible.
For example, I have an HTML page which includes an element like this:
<object id="simpleControl1"
classid="http:RenderTextProject5.dll#RenderTextProject.ScrollableControl"
height="300"
width="300">
</object>
The 'classid' attribute value has the following meaning/syntax:
RenderTextProject5.dll is the filename of a compiled .NET assembly
RenderTextProject.ScrollableControl is the qualified name (namespace plus classname) of a class which subclasses System.Windows.Forms.Control
I can then see the control being rendered in the browser.
I'm using IE (IE8, but it used to work with IE6 too), and I have the .NET framework installed on my machine (but I think I needn't have the RenderTextProject5 assembly installed on the client machine).
There may be some other caveats too (e.g. I needed to run in the Intranet security zone).
See Return of the Rich Client: Code Access Security and Distribution Features in .NET Enhance Client-Side Apps.
Look for Silverlight.. It is maybe not exactly what you need but it is a browser plugin capable of running C# code ;)
There is a relatively new plugin called Unity. It is a bit more complex, as it is a dev/3D authoring environment on its own, but uses C# as its language as far as I know. However I don't know if pure 2D programming is possible (well, may be worked around using ortho 3d?).
The basic version is free to download recently, maybe worth a check.
It is possible to run C# applications in a web browser without using plugins. For example, C# applications can be compiled into JavaScript applications using JSIL.

Resources