Make a game written in Javascript available online - javascript

I've just finished a simple game in Adobe Animate using the HTML5 Canvas. I now have .fla, .html and .js files. Can I now put these somewhere on my website to make the game available to play? If so, where? If not, what else do I need? Thanks.
Clicking on the HTML file opens it in a browser, but I can't interact with it.
Thanks.

You're stepping in to a whole new world of hosting and deployments. To have a functioning website you need:
A host server
A domain name
Web files (which you have)
The host server will serve up your web files and allow incoming traffic from the web.
The domain name is optional, but helps with visibility. Without it you'll have to connect directly to the IP address of the host server.
I'd recommend finding a host like HostGator, GoDaddy, or Amazon S3 if you want to host a static website. It can be pretty intimidating at first, but you'll need to put in the time reading documentation to fully understand the process.
Alternatively, if you just want to get it running locally and not on the internet you can install a simple http server on your machine. I use NodeJS so I'll test with http-server alot. Hope this helps!

Related

Is there a way to implement IPC to a HTML5 web browser (served using LAMP server)?

Forgive me if this is a silly question but I could really use advice on the direction to look at for a project I am working on.
I made a webserver that streams RTSP to a webpage using LAMP, php and mysql; and served a html template. This was done on a raspberry pi and it all works fine as is. Also done on an Ubuntu VM.
EXAMPLE I FOLLOWED: https://www.thewebblinders.in/programming/article/rtsp-streaming-on-a-web-browser-6069
The next part of my project was to add buttons to the html page, that when pressed send a universal protocol command. I found that I needed to do this using IPC (inter-process communication) however I'm not really sure how to implement this to what I have now.
At the moment my system works simply as a html webpage that is served from /var/www/html using npx http-server --cors (from the open source server environment NODE.js)
I'm not really sure how I could implement a python or javascript back end that communicates to something like electron.js (I tried the latter method but had no success).
Would it be a separate program that acts as a server that hosts the html page instead of Node.js? Would I still keep my templates and methods in the LAMP src directory (/var/www/html)?
Any advice on the possible direction I could look at would be a lot of help. I've not found much online that discusses IPC work on html templates served by node.js. The only html related topic I've seen relating to it is JavaScript with electron.js and that changes the way my webserver is ran.
Thanks for taking the time.

CORS issue with HTML5 canvas, javascript

I have 2 HTML5 widgets, both made with Phaser.js and having images and audio, which are loaded on the fly by phaser library.
One of the widget(HTML5 file) works on local file system without XAMPP, while another only work when serve through XAMPP server.
I want to know why some HTML5 canvas files works without server while most of the time we require some server for canvas files.
Its a great confusion for me.
Plz help.
There's a very good explanation of why you need a web server on the getting started page for Phaser.
What it boils down to is you need to use a web server because:
It's to do with the protocol used to access the files. When you
request anything over the web you're using http, and the server level
security is enough to ensure you can only access files you're meant
to. But when you drag a file in it's loaded via the local file system
(technically file://) and that is massively restricted, for obvious
reasons. Under file:// there's no concept of domains, no server level
security, just a raw file system.
...
Your game is going to need to load resources: images, audio files,
JSON data, maybe other JavaScript files. And in order to do this it
needs to run unhindered by the browser security shackles. It needs
http:// access to the game files. And for that we need a web server.
Technically, none of your Phaser applications should run without a web server, it's quite odd that you got one of them to.
Set game.load.crossOrigin = true in your preload code and it should work.

Opening file folder present in a FTP site in file explorer on the client-side

I have a folder structure in FTP, that I am trying to access and open in file explorer on the client-side using javascript in my asp.net application. Using window.open("ftp://192.168.1.10/clients/112"); opens the folder in the web browser how do I make it open in the file explorer.
The real answer is that you do not understand what you, in any way, are doing. You are trying to cross standards which is prevented inherently, but by your lack of technical knowledge, you don't know help when you see it. The part below shows ways to possibly handle it.
For a machine to connect to an ftp server, they need to authenticate and do so over the correct protocol. That is not the protocol that browsers use.
Now, that is not to say that I can't go in my browser, type ftp://... and see a directory. But that is totally different. Your browser switches protocols based on your url. That can't just happen when your a webpage in a clients browser.
Your web server can conduct ftp traffic though. You can read that structure and show it to your user. https://msdn.microsoft.com/en-us/library/ms229716(v=vs.110).aspx
A clever guy can make this happen. It used to be easy in flash/flex, but.. progress.

Lauching .bat or .exe client-side

I face an issue for a client who need to launch an application from a ASP.Net website client side. For the moment the solution is using ActiveX, but we all want to find an other way to do this action.
I read this links to find informations :
Is it possible to run an .exe or .bat file on 'onclick' in HTML
https://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx
I know that for security issues, browsers don't allow the launch of client applications, but did someone find a hack to do something like that and have a sample to post ?
Have a good day
The technology exists for YEARS and it's called ClickOnce.
https://msdn.microsoft.com/en-us/library/142dbbz4%28v=vs.90%29.aspx
It requires the .NET Framework at the client side and a support from a browser (some browsers require a plugin to correctly handle ClickOnce apps).
Applications are deployed either in a form of a self-extracting installer (setup.exe) or a link to an XML document, the manifest, that describes location of other components (appname.application). In any case, a client just clicks a link, the app is downloaded and run locally, using local client permissions.
In particular, the app can read/write local files, use certificates from the local store, print documents using local printers, call other services ever if they are cross-domain etc.
And note that such ClickOnce application can run client local processes without any restrictions. We use this feature for years and it sounds like this is exactly your scenario.
Theoretically it could happen if a service was listening on some predefined port and the application simply sent a specific request to that port.
Other than that, I don't think it's possible to directly execute an application on the user's computer.

Changing download folder for a specific web application

I think the answer is going to be "not possible" but it doesn't hurt to ask.
I've created a web application for a specific user that in part creates Word Doc documents on the server that they then download to their local machines.
My end user is not an experienced computer user and occasionally "loses" the files they've downloaded. (They're in the default download directory mixed in with other things they've downloaded!). It would be preferred if files downloaded from my web application went to a specific folder.
Is there a way to do this either in the web apps code or as a configuration of their browser?
The web app is built using MS Web API 2/C# for the server and Javascript/JQuery/Knockout on the client side.

Categories