What I am looking to accomplish is when a website is hosted locally on the localhost if it would be possible to track the clicks/navigation kind of like google analytics does but a very simplified version of having time stamps, and counts using primarily HTML5 and Javascript. I haven't found much information doing something like this with localstorage either. Primary reason is to keep tracking information for what information would be accessed without being online/needing a internet connection.
If I remember correctly one of the issues of localhost, is the inability to have scripts change files on the localhost directly(AJAX) and would require to be sent to a server. Preferred if it did not require server side languages such as php, etc.. Since how this would be used would not always have mamap/wamap installed.
Any help would be great, or a direction.
Related
I've written some code that retrieves some data from google sheets then updates some content on my google sites. However, while the script works (when run on localhost) I encounter the
"details": "Not a valid origin for the client: https://966655698-atari-embeds.googleusercontent.com has not been whitelisted for client ID MY-ID. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
However, I enabled this for localhost, cleared my caches. The problem is the 'https://966655698-atari-embeds'. Each time the google site loads it generates a new random number sequence. Does anyone know how to workaround this? The google site uses embedded html which I believe is why the initialization failed.
I have tried to white-list https://googleusercontent.com which didn't work (I didn't think it would because the domain changes) but I'm honestly incredibly stumped.
Google hosts all user content using their somedomain.googleusercontent.com. I do not know for certain, but I'm almost sure that to save space they dynamically host their content, meaning that when the embedded html does not need to be actively hosted, it isn't. I had to find a way to host from a site that would always send the request. For me, I found that github pages was the answer.
I found this on adobe's website which somewhat explains what googleusercontent does. https://helpx.adobe.com/analytics/kb/googleusercontentcom-instances.html
To set up github pages this link will explain how to do so https://guides.github.com/features/pages/
You can add this to the developer Google console relatively easily and any connection will submit from your username.github.io. (I believe it also uses https protocol). It also allows me to implement directly using git version control and implements nicely with WebStorm.
I'm here because I have a very particular problem, but first a piece of background information:
I'm setting up a website that isn't made to run online on a server.
It just should run locally on the client's computer being saved on the clients stick, because I wanna avoid being dependent on the internet. Added to that I don't wanna save data using cookies or smth. similar, because I cannot be dependent on the browser or the computer (as already said above: the website is saved on someones stick).
So there's the problem that I want to save user-data in a text-file via javascript. Coming of Java I thought there would be not problem doing that.
But after some research I heard that this isn't possible due to security problems (which sounded logically).
But in my case these security problems are not really relevant in view of the facts that it runs locally and is made for a very small group of trusting people (10-15 people).
So is there a way to just put some small user-data in a text-file (theoretically the file could already be created, but empty) in the folder of the website?
Running a small HTTP server is a working possibility. Name the html file index.html. On Linux, python has a built in HTTP server with python, python -m SimpleHTTPServer. On the Windows systems, I include an HTTP server exe, like HFS, in the same folder. The website can be connected to using localhost. Something like localStorage would work then.
There's probably something better than this, but it worked.
http://www.rejetto.com/hfs/
We are currently looking at porting a enterprise silverlight application over to html5. The major roadblock that we have hit is the ability to open files from the user's local disk. Currently they have a document library which just links to files on their computer that they can open from within the app and view or print out. All that I read is that you can only access the local sandbox of the web app with the html5 file api's. We want to load these files from code.
Does anyone know of any workarounds to this?
Thanks
There is no way for html5 to access local file without user selection. But FSO: FileSystemObject works for IE and MAYBE could be regarded as a work around. But still there are some requirements to meet.
It is possible to use chrome's filesystem API to access files on a users local filesytem. So you'd have to be willing to make this a chrome only application.
Using java you can create a "Signed" applet which has access to the local filesystem. (if the applet is signed you can request filesystm permissions)
then there is a tutorial for accessing methods of your java code directly from javascript here: http://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
you should be able to perform something similar from silverlight.
There is no workaround in pure HTML5/Javascript. You need the use of plugins, such as Java or Silverlight (maybe you shouldn't port it after all). As for workarounds, HTML5 gives you an easy way drag and drop multiple files that you could transfer on the server and then display back to your users. Another workaround would be to install a custom agent (a software with only a tray icon) that would send the information about the current user "document library" to server and then again, you could display it back to the user.
Note: I've heard somewhere that browsers will eventually stop supporting plugins. http://www.howtogeek.com/179213/why-browser-plug-ins-are-going-away-and-whats-replacing-them/
Ya, I agree with Markain. However, if you were to limit your audience solely to chrome users, I daresay, you would most likely use some of your users. If Huazhihao is right, then your number of leaving customers should decrease but users who regularly use firefox won't be happy. Overall, I think that this will not work. Otherwise, there would be too many websites that trashed your hard driver (or at least wherever you have the rights to edit/delete files). I think it would be best if your product was setup to synchronize the file whenever an internet connection was detected and a change was made to the file. That way the user would not need to visit the website whenever the file was uploaded. If this is some kind of an error file, then it would be most beneficial if you were to make a link in the application that when clicked, would upload the file to the website and the website were to do whatever was necessary. If this is a purely online thing, then I don't see what business you would have looking through other peoples' files =-). Hope I helped!
I built a CRM for a client of mine, and now they've requested an interesting feature:
For each customer record, they have a matching directory of files on their local computer. They want the ability to open that folder in Windows Explorer directly from within the web app (the app doesn't need access to the directory/files; it just has to launch Windows Explorer so that the user can interact with their files).
This is obviously not possible with regular JavaScript running in the browser (thankfully). I thought there might be some way to accomplish this by building a Chrome extension for this purpose, but it seems Chrome extensions/apps can only access a sandboxed filesystem, which doesn't serve my needs at all. Building an NPAPI plugin in out of the question since Chrome is discontinuing support for NPAPI.
File URIs don't solve this problem either. Their display is ugly, there's no drag-and-drop, no big icons/thumbnails, no sorting etc. They want the full capability of the Windows Explorer.
The only viable option I thought of is to create a local node.js server, make a localhost CORS request to that server, and then run an exec command from node.
Any better idea?
One possibility is to register a custom URI protocol handler with the user's operating system, and then your web page can contain links using your custom protocol, such as openfolder://c/path/to/folder This sort of customization is probably most commonly seen in practice with itunes:// links.
A quick Google search led me to this decent looking tutorial: https://support.shotgunsoftware.com/hc/en-us/articles/200213756-How-to-launch-external-applications-using-custom-protocols-rock-instead-of-http-
The downside is that the user will have to run a small installer of some sort in order to set the correct registry entries (or whatever the non-Windows equivalent is for other OSes) and to drop a small script on disk. That would be much lighter-weight than running a node.js server like you proposed, though.
The linked tutorial uses a Python script, but even that is probably overkill for your needs. A batch file would likely suffice.
EDIT: One additional note, please be aware of the security implications of implementing a custom handler like this. Any webpage in any browser can potentially take advantage of your custom protocol, and an attacker would be able to pass arbitrary data to your script. You should take steps to ensure that the script will not accidentally execute arbitrary commands that may be injected by a malicious web page, and that it will only open a folder and nothing else.
That would require each customer to run a node.js server, which seems unrealistic in your case.
You could use File URIs.
Browsers will refuse to open them by default. However, as suggested in this answer, you could ask your customers to install LocalLinks.
I'm wondering what are the pros and cons of having the raw phonegap html files sit on the actual device vs only having a "jumper" page that'll redirect to an app hosted remotely on the cloud.
These are the things that i could think of:
offline access - is much simpler when the html files sit on the actual device, otherwise you'll have to use HTML5 offline API. +1 Local
View Helpers & Embedded Code - Whether building with Rails or Express i'll gain access to view helpers and embedding if i go with a hosted solution, just like when building a "normal" website. +1 Hosted
Rest API - If i keep the files locally i'm forced to create a completely separate API to handle to handle all server communications (unless going with something like StackMob). While this might be useful later on if decide to multiple clients it's probably overkill ATM. A hosted solution would handle server calls the same way "normal" websites would do.
+1 Hosted for simple apps
Any other Pro's and Con's i'm missing?
Normally I would locate the static files on the device itself. Otherwise, you always have to request the files via GET (bad for traffic and performance especially on mobile devices).
When you want to put your app to the Apple AppStore, you have to care about redirecting to an online WebApp only I think you will get trouble with Apple.