Soppose I develop a client web app (I don't have access to server code), Is it possible to detect when user downloads a file? I need something like:
//fires when user download file
function downloadFileCreated(obj){
alert(obj.url); // prints the download link
}
here they assume that I have access to server code (but I don't have)
(I'm working on InternetExplorer add-on and I want to inject script that listening to user download)
How about using Google analytics like mentioned in below post?
Best way to count number of downloads of several files on website
Related
I want to open files from webpage. For example when we try to download a torrent file it redirects us to utorrent app and it continues it work. I also want to open a local file somehow using OS software. Like a video file using pot player. Is there any possible solution for me ,like making a autorun in pc to run that . Anything it may be please help me.😔😔
I searched and found a solution to open a software using protocol, but in this way I cannot open a file in that software.
Opening a specific file in a specific software would usually depend on passing some URL parameters to the protocol-URL of the app (e.g., opening a file in VSCode would use a URL like vscode:///Users/me/file.html, but this functionality would have to be explicitly handled by the app itself though, so the solution for each app would be different).
Otherwise, if the app doesn't support opening a specific file itself through a URL, you'd have to use some scripting software (e.g. AppleScript if you're on macOS) to dynamically click/open certain programs on a user's computer.
the link acts as a magnet so your torrent application is opened maybe delete torrent for sometime till you finish the project, i know how to open image in local files in html but it will only be visible to you, you can do audio and video files also using <source src="movie.mp4 and on next line `type="video/mp4">
I'm a newbie when it comes to javascript, but since I have a local intranet web app at work, which I would like to programmatically retrieve a file from by programming another website on the internet, I was wondering if it was at all possible to make client-side (browser) javascript request another website (on the local intranet) and click a button and retrieve a file ? (the next step is to parse this excel file to json in the browser but that's a separate problem).
I have looked at artoo.js on github but am unsure if this is up to the task of clicking a jquery loaded button on that site in question, and retrieve a file.
The local intranet app lacks an API.
You can't. Javascript cannot access (private) local file without an explicit file upload made by the user. For public files (i.e. files on a web server) make sure to check if Cross Origin is set up correctly
You can't, unless Cross Origin Resource Sharing is enabled for those files.
Update :
This can be done using Chrome+Pupeeteer+Nodejs..
Read This post this gives a Full Tutorial How to scrap data from a webpage automatically and more..https://codeburst.io/a-guide-to-automating-scraping-the-web-with-javascript-chrome-puppeteer-node-js-b18efb9e9921.
..
make client-side (browser) javascript request another website (on the local intranet) ...
this can be achieved without cross-Origin Resource Sharing If both website are on same server..as in your case LOCALHOST.
click a button and retrieve a file?
For this, you need a js runtime for executing another website client-side. then you can apply js scripting on the page and manipulate the Dom or fire an event like a button click.
But this is very complex to do So alternatively directly access the file or make a common API endpoint for both the websites.
As the title indicates i want to have a certain application get access to the local file system. To describe why i will illustrate my situation:
I am a running a IIS WebApplication with the C# MVC 4 Framework as backend module. The site solely consists of HTML, CSS markup and some JS. The page will be loaded in IE11+ (Edge) only. For the standard procedure of displaying and accessing data from as well as sending data to the server this works quite fine.
On a certain page I want the user to be able to upload a file using a simple file dialog, like the one you can initiate with a simple <input type="file"> tag. I also want to offer the posibility to download files from the server but need to know where files has been saved / will be saved to.
As described on a lot of different websites, just like this one here, the HTML5 File API does a great job but will not be able to return the full qualified filename including the local path directions, same for JS accessing the file object.
As my research confirmed HTML5, JS and also SWF (Flash) will not report detailed information because they are all sandboxed applications or restricted by RFCs. I already unterstood and appreciate the effort to secure my trips to internet.
But in this case do need the paths where a file was upload from and the file has been downloaded to.
So my question is, what is the best way to expose the full path directions for a up- as well as downloaded file to report them back to the server?
Is it possible to embed a SWF object inside HTML which will run inside an Adobe AIR sandbox or is a signed JAVA Applet still the one and only solution to accomblish this security breaking task?
A solution i would also apreciate would be the possiblity to ask the user to get access the file system, like you grant access to the web push service to receive notifications.
Also if there is a possible solution which may suite my circumstances please let me know by adding some simeple examples / revealing some factful links, thanks in advance.
I'm relatively new to this
We have a requirement to save a file with out the use of the dialog box.
I was wondering if I can use AJAX or some other JavaScript to "Push" the file from the client PC being viewed in a browser to to some web service the client is running and have it save the file.
Do I get into cross site scripting issues or an issue I don't know about at present?
Thanks
With valums uploader script, users can drag and drop files (in certain browsers) to a button on the page.. so, yes, no dialog box, but it still requires user interaction. (I also know IE10 should be able to handle drag/drop functionality from one of their demos; so this kind of functionality is gaining ground).
I don't think you can upload a file without a dialog box. That would remove the user interaction, so it would be the same thing as allowing a webpage to select any file it wanted and upload it without user interaction - an obvious security flaw.
Generally, without a dialog box, no it can't be done.
HTML5 has a file API where the web app can store files on the local machine. But this access to the filesystem is sandboxed, so you get to access files only under your directory.
Why can't you do without a dialog box? Imagine you visit some site and it "uploads" files without your permission. That's a security FAIL. The dialog box is the user's authentication for the file to be uploaded.
I have a web page containing a list of pictures urls (can be more then 1000 items) and I want to enable a button for the user to click and download all of the files to the local hard drive.
The download process should ask the user for a directory to save the files in and then go ahead and download all files to that directory (if possible, creating sub directories inside). This should be done with a single user confirmation for the whole download process and avoid display the browser save dialog for each file.
Is there a way doing that? I am aware I can't use the standard HTTP protocol for the downloads and have to write some kind of control to do the job. The page is written in asp.net.
Downloading to the server, packing and sending to the user is not possible. The download has to be originated from the client machine.
You should update your question to include the requirements from your comment, because they make a huge difference. If the server cannot retrieve the files, because he doesn't have the right permissions, your only option is to run the code on the client side. There are several options how to do this, mostly depending on the clients and your coding skill:
Flash (Not sure about the security aspect of writing to the local file system, though)
Java Webstart (Disadvantage: Clients need to have the Java runtime installed)
Browser plugin/extension (Disadvantage: You can only support a subset of browsers and the page will not be immediately usable, as the plugin or extension needs to be installed first)
In all cases, you will have to write a tool, that retrieves the URL list from your server and starts downloading it.