I have a search page.
On clicking search it will show a jquery modal with processing image and redirect to results page.
I have download functionality also in the search page. If I select the download option,
the result may vary to 1 kb to 25 MB, and I can't put a timer to close the modal window.
Is there any way to find the download is prompted?
Or download is completed? So that I can close modal at that time!!
Just make a popup that disappears when the user click anywhere else, like on github.
It would probably be too much job doing what you requests that it is not worth it. Better just showing a dialog that the user can dismiss whenever s/he wants to.
Well, yes it would be possible to have a script that runs while the file is being served (PHP normally times out within 30sec) and have periodically AJAX-requests to see if download is completed (or aborted).
Related
I've got a "download.php" script which serves up files for download and the user can choose to download a ZIP file which is custom to them.. so needs to be generated on the fly.
The problem I've got, is if the user clicks the ZIP file 5 times in quick succession, the ZIP is generated 5 times on the server.
I need a method to only generate this on the first click, and not keep generating over and over again.
I do not want to "disable" the link permanently, because downloading the file again a few minutes later is fine if the user wants to, I just want to try and stop a malicious user hammering the download script to generate ZIPs constantly using server processing power.
Any ideas? I've been trying for hours and can't seem to get a solution which works :/
Thanks
Is it an option to include a captcha code or similar to activate the download? That would stop the fast clicking.
Add jQuery to the front page to disable the button after the first click. Something like:
$("#button").click(fuction(e) {
$(this).attr("disabled", "");
});
Also, you could cache the zip files for a certain amount of time so their only processed once for a thirty minute block, or some time frame.
I am trying to create an application (jQuery or JavaScript) that will print 100 unique invoices with 1 click of a print button without calling the print dialog box.
Requirement is that I don't want to allow website users to access soft copies of their invoices.
Problem is that the JavaScript print command window.print opens a dialog box for each invoice and in my case it will ask 100 times to print next invoice.
Any help will be highly appreciated, thanks in advance!
You can't bypass the print dialog box, but you can generate all your invoices before triggering print dialog
If it is displayed on screen at any time, the user can print screen it. Disabling print screen won't work since you can do screen-capture with hardware, or even simply a camera phone.
If it is not displayed on the screen, then it must be in the client's machine's memory, if they really want to, they can still extract it. Simplest case maybe just adding a breakpoint in the javascript or opening up the source.
If the document to be printed is not stored in the machine, then what are you asking for is really to let your server to control what exactly does the user's printer prints without confirmation. I don't think it is possible.
Moreover after the users have printed it, they can still scan it back as a pdf, or even OCR it to get .doc or text.
I wonder what makes you want to prevent the user obtaining a soft copy.
I'm creating a website and I'd like to allow users to upload multiple files while they navigate the website.
When the upload completes, it would be nice to have a Javascipt event triggered, to allow the user to specify additional info related to the uploaded files (eg. photo location, tags, etc)
anyway, the required features are:
multiple files allowed for a single upload operation
display an optional progress indicator (at least in the "x of y files uploaded" fashion)
doing it without tying the users to a single page
How can I implement these features?
Any suggestion is greatly appreciated!
Edit
In the event of using a popup window to handle uploads, how can I:
inform the user (on the "master" page) that the upload has completed, or that there have been errors?
(more important) pass the $_FILES array to the popup window? I'd like the user to be able to click "upload" on the main window, or anyway to make the upload start from the main window (eg dragging and dropping files on the main window).
Since navigating the site will switch pages and it's unlikely that there's a full ajax navigation on your site, maybe it could help to somehow upload the files in a second popup window. Not sure how (if) it could be implemented, though, but since you need to upload multiple files at a time I'm afraid you're bound to use flash.
EDIT
So the solution could look like this:
When a user clicks a "select files" button you pop out a new window where he'll be able to actually select files (via flash if multifile upload is necessary). And to notify of upload progress use postMessage. Though postMessage isn't going to work in IE in this case, but probably you could somehow send the message to the server and from the server back to the page.
Another crazy idea is not to use a popup window, but let the user select the files on the page she was first, but once the user selects the files make all the links on the page target=_blank to make any subsequent navigation happen in another tab. I know it's hacky and not exactly user-friendly, but probably could help.
In any case I would inform the user beforehand that a new window will appear in both scenarios.
EDIT2
And an even crazier idea. When the user selects the files and clicks a link create an iframe which will cover the whole page and hide the original page beneath it and make the links open in the iframe. But it looks even more hackish and it seems you'll have much trouble with it.
I have some links that when the user clicks one, it links to a php script which runs some stored procedures to generate data and then calls another script to download the data as an excel spreadsheet. This all works fine.
What I'd like to do is have a loader gif appear beside the link that was clicked clicked and when the dialog appears to get the user to save the file, have that gif disappear again.
Can I track this event at all to achieve this? Not had much luck so far.
I would call the generate script as ajax, and use the success and error functions to recognize completion of the script? THen you can just start the animation, call your script, and when it returns you can cancel the animation.
I have pages with photo thumbnails, let's say the script is thumbnails.php. Each icon has a link to popup.php?id=nnn that opens in a pop-up window to display a larger image and some info.
I don't want a user going directly to domain.com/popup.php?id=nnn to get the popup small content in a whole window or tab.
So this script first checks if the referrer is the page containing the thumbnails.
If not, descrption.php?id=nnn is opened. This page is designed to fit a regular screen with extended info.
I did in this way mainly thinking in web crawlers.
Is this a good practice?
Many projects that I have worked on over the last 18 months have gone away from opening new windows or tabs altogether. Instead they use the Jquery Dialog (modal mode) to display images, html descriptions, or other attribute information.
This allows the user to stay on the same page without the risk of causing them to bounce if they accidentally close the wrong window or tab, or they just forget to go back to your site via the original window.