Generating Dynamic web pages without server side scripting - javascript

I am trying to control a media device which has lot of multimedia content that it can play using another device(remote control device) like an ipad connected to the LAN. (UPnP)
I want the media device to be able to send the content listing to the remote device so that it will be rendered as a webpage on the remote controller. And actions on the webpages needs to be sent to the the device as commands to execute (like play, pause, next etc). The media device is an embedded device, hence can't have any server side scripting, all has to be done on the client side.
I want the page rendered to be HTML5. So, is it possible to generate dynamic HTML5 pages using just client side scripting?
Thanks a lot.
I am an embedded systems developer hence clueless about the web designing stuff.

Yes, this is possible. I work at Plex, and we have a similar need. Our Plex Media Server is a bunch of C++ software that doesn't build web pages or anything like that, it just serves static files and has API endpoints for controlling media.
I built a media manager that allows configuring the system (but not playback as of now, but the principle is the same) using a web page that is totally static. In fact, we use Cappuccino, which is essentially a JavaScript-only way of building a web page (there's essentially just enough html and css to bootstrap the Cappuccino environment). It uses Ajax to hit the C++ API to do anything else it needs to do.
You might try something similar, but it by no means needs to be Cappuccino - you can do it perfectly well with jQuery, HTML, and CSS.

Related

How to twitter like load a webpage

I'm the only one that noticed that the new version of twitter desktop even if there is no internet it still loads the main styling and then just tell that there is no internet? Well I did and now I'd like to make to a website that can be loaded even without internet, can anyone tell me how? I'm using pure HTML, CSS and js as front end and node js as a back end.
I currently have no idea how to do it
I'd like it to load ad be able to run flew scripts to generate elements on the page.
It's called Progressive Web Apps, Progressive Web Apps (PWAs) are web applications that are regular web pages or websites, but can appear to the user like traditional applications or native mobile applications. The application type attempts to combine features offered by most modern browsers with the benefits of a mobile experience.
https://developers.google.com/web/progressive-web-apps
https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp
A Web cache (or HTTP cache) is an information technology for the temporary storage (caching) of Web documents, such as Web pages, images, and other types of Web multimedia, to reduce server lag. --Wikipedia.
The web page is already stored, when you load it loads from the cache and a function which checks for connection gives the alert of no internet connection.

Servier side and client side device detection

We are having two module of same web application in Servlet/jsp. One for mobile and one for desktop. I want to redirect to mobile version whenever an handheld device hit a desktop version. Since I am having two different context of same application, which will be the best approach for this. Server side device detection or client side detection and redirection.
Thanks in advance.
This is no different than redirecting between two different applications (or even two different servers). You might have good reasons for separating it like this, but I would consider having only one application, and using responsive design (media queries) for serving device adapted content. But if you really want to do it as you describe, I would do the detection on the server side, as doing it client side would rely on being able to execute javascript on the client, which may or may not be enabled or blocked.
But whatever approach you choose, please, please, please let the user override this by his/her own wish. And when doing the redirect, please, please, please don't loose the context the user was trying to access in the first place. The worst thing I know are websites that redirect to a mobile website after trying to reach a specific part of the website (typically an article), and then just being redirected to the root of the website, and then having to try to locate the part of the website (article) I was looking for...

Change server HTML app into self-contained desktop app

I wrote a simple web server that takes the public link to a google document containing image urls and names and outputs a print-friendly HTML photo directory with its contents.
I created it for a volunteer organization that I will no longer be able to stay involved in. I need to pass on the ability to generate that directory to my successor.
I'm not confident that I can trust myself to maintain that web application for the long term the organization needs. I'm hoping that instead I can change it to a self contained program, that members of the org could email around to whoever needed to generate the directory.
My first thought was to make a .html file the could open in a browser but I can't download the CSV data from google with Ajax, because it is cross domain. After googling there doesn't seem to be a way around this.
Is there a straightforward framework? I would guess I could do it with Adobe AIR, but I'd prefer something that simply removed the cross domain security feature.
I could take the time to embed a UIWebView into a Mac app, but since I want to write the app primarily in HTML, I'd have to create a bridge to let the web view make a cross domain request anyway right? Also it's not cross platform.
Any other ideas? How can I package my app as a desktop application instead of a web service?
You can get around the cross domain XHR using flash. CrossXhr can do it from apps served by regular http servers. I've never tried it with a static, file-served webapp. Follow the instructions here:
http://code.google.com/p/crossxhr/wiki/CrossXhr

connecting javascript to php socket to communicate with Flash

I'm trying to build a projection installation for a university project, I want the audience to be able to communicate with the installation with their mobile phones.
This is what I'm trying to do:
- My Flash application will be running on a computer connected to the internet and will be connected to an XMLSocket hosted on my server.
- I need a javascript page which the audience can visit, mouse clicks (touches) will then send data from the javascript page to the socket server.
- Flash application will receive the data and so on..
Is it possible? I've been looking around for various resources, but they all require a flash app to be on the same page, which is not what I want.
I just need a standalone javascript page to be able to talk to a flash app.
Any suggestions or ideas for possible work arounds will be greatly appreciated.
Many thanks,
Will
Yes definitely possible. The server sits between the two (Flash and JS), they don't need to know each other exist. JS sends data to the server and Flash pulls it down.
I am not sure to fully understand your question.
There is no such thing as a "javascript page", javascript is a... script running in a browser environment.
In the case you want to use an Android/iPhone app environment I don't think you need javascript to do this.
But if what you want is to have a web/wap page accessible to the mobiles, with a user interface, buttons, text field, whatever, which communicates in both directions with your XML socket, you need to build your user interface in HTML, and then to use some javascript to call your XML script and translate the response in the interface. If you have a server, can't you host also your UI there? The cross-domain issue would be avoided, otherwise it's easy enough through any server-side script (PHP?).
So yes it seems very possible, but I don't see what you mean by "they all require a flash app to be on the same page". Here's what I understood: Your Flash app is not what you want to load in the mobiles, it's connected to the server's XML in/out and working fine. You just want an interface communicating with this socket. Right?

Does anyone know of a GUI-less application that can be called from JavaScript to create and save desktop screen shots?

While the subject could sound like I'm looking to do something shifty, I'm not; I maintain an internal web site used by several hundred phone operators, and would like to add the following functionality:
I would like to add a control in the header of all of the web pages that would capture an image of the entire desktop and save the image as a file to a shared network drive to assist in troubleshooting production problems. This screen capture app would be called by JavaScript.
I've researched many threads on this site pertaining to capturing screenshots, and all of the offered applications don't meet my need in one of two ways:
The screen capture application has a GUI that pops up and the user sizes some sort of capture control or interacts with a window to do the capture. The users are not very computer literate, and could not be trusted with using a "pop-up" application correctly-- and it would be impossible to enforce them to save the image file with a common file naming convention. I would like the user to press a single UI control on a web site and have JavaScript make the calls to obtain a screen shot and save the image without any further user interaction.
Some automated applications save the HTML by re-posting to the site and "re-assembles" the individual HTML elements into an image. This will not work as the input data that the operator has typed in needs to be in the image, the site uses AJAX so the visual "state" of the web page will be different from one re-obtained from a POST, and some applications have had (active directory) security issues when trying to interact with our (secured) web sites.
If there isn't an application that will meet this need, I'll just roll my own control in C#. But I'd rather obtain a third-party control. so I don't have to support my own control for life. :-)
Javascript does not provide access to the local system for this functionality due to the security risk.
I believe the only way of doing this on a web page is possibly via an active X control or Java applet (similar to screencast-o-matic) but even then security may be an issue.
I also image unless your own c# control is in a windows forms application it would not work as c# controls that are part of a web site will be run on the server and not the client.
Hope this is of some help.
Well to do that you'll need something to interact with the desktop which can't be done by javascript alone.
You'll need to have an Active X Object to be able to interact with the client's machine. Once you have that, it is easy to just have the object take a picture and save it to the directory.
I believe I have the C# code to take a screen shot. If you want I'll post it.
Some alternatives to ActiveX / Java:
You can create a flash program to do the screen capture. I haven't done this and don't know the details, but I'm fairly sure it can be done.
You can setup a custom protocol for screen capture (eg. screencapture:// ), and in your header include a
Screen Capture
link. You'll need to find a gui-less screen capture program to do the actual capturing and set it up as the handler for that custom protocol.
Did it once. I couldn't find a direct way so did it rendering HTML to canvas, then canvas to image using html2canvas. Canvas to image is a much more common theme so you'll find many tutorials about.
HTML to Canvas
Canvas to image
NOTE: rendering from HTML to canvas may leave some elements behind, like SVG. But overall it did as much as expected.
PSR (problem step recorder) is a great tool for debugging purposes on client machines and it is available on all windows machines by default.
Try below and see if it works for you.
Go to Start->Run and type psr.exe (or just psr) this should open the recorder. This is fairly easy to use, so even users/clients can use it. If it works then try below steps to setup.
Step 1: Register PSR protocol. This tells the browser what to do when a link on the page is referring to PSR protocol (which we will use to open this recorder).
- Create registry values as below
HKEY_CLASSES_ROOT/
PSR/
(Default) "URL:PSR Protocol"
URL Protocol ""
shell/
open/
command/
(Default) psr.exe
If you are not comfortable with creating registry values, download and double click this file.
Use this link for more information.
Step 2: Now create an example html file to test launching PSR.
Save the below code to index.html file and open it.
<html>
<head>
<head>
</head>
<body>
Start Recording
</body>
</head>
</html>
Or download this file and open it.
This should open your PSR. It is easy to use and can record all the information you need for debugging.

Categories

Resources