Email before download just hangs after clicking link
-
Nearly 2yrs ago we were more active on our website and monitoring the downloads. Fast forward to now we updated plugins to:
Email before download 3.4.2
Contact Form 7 4.4.1
Download Monitor 1.9.2Since adding new content (pdf’s) have found an issue appears after completing the contact form + captcha and clicking the download link nothing happens. Essentially a blank page with the url eg. https://protechinc.com/wp-content/plugins/email-before-download/download.php?dl=c74060bcf789f1935deeaff82e6e4e04 and thats it.
This is consistent for any older contact forms and new ones.
1 attempt at a fix I noticed the Contact Forms complaining about a configuration error in the from field. so after changing [FullName] <[Email]> to our actual email address contact forms is happy but no luck with a download.
Feel free to download a form from our homepage https://protechinc.com/ or a new form/brochure from https://protechinc.com/jettrac-fire-inspection/Thanks!
-
In the CF7 form you created for EBD, you must use “your-email” as the field name for the email address. It cannot be “Email” or anything else, it must be your-email as shown on the screenshots page.
Also, just as a side note, on your test page there is a syntax error in the javascript for google analytics on line 447. It looks like that line has some smartquotes or backquotes or something rather than regular single quotes around a couple of the words on that line. I checked your homepage and it doesn’t have that problem (though it could be coming from your cache I suppose).
I added ‘your-email’ to the From Field and after entering dummy data into the form and clicking submit I get an error message instead of a link: There was an error trying to send your message. Please try again later.
I also tried surrounding it with [], <>, <[]> with the same result.I have taken screenshots, this might make things clearer:
Setup with your-email in from field. Contact form output issue.
https://webdesign.protechinc.com/FromField_CF7.PNG
https://webdesign.protechinc.com/ErrorTryingToSendMessage.PNGSetup with email address in from field. Contact form link appears.
https://webdesign.protechinc.com/FromField_CF7_Ok.PNG
https://webdesign.protechinc.com/ThankYou_LinkAppears.PNGAgain the only issue occurs after clicking the link it just hangs on a blank page, nothing downloaded like normal.
In the CF7 form, you need to be on the “Form” tab, not on the “Mail” tab. The “your-email” needs to go in the -form- that you made on the Form tab, not in the From field on the Mail tab.
See the 2nd image down on the Screenshots page – https://www.ads-software.com/plugins/email-before-download/screenshots/
That screenshot is from an older version of CF7, but you’ll see what I mean. That html form there is similar to what you’ll have in the Form tab. You need to look at the one for the email input field and make it’s name be your-email rather than Email (which is what I think it is right now).So yours needs to look like the one on that page .. something like:
[email* your-email]
or with the akismet stuff maybe if you use that.Ok seeing some changes, but this time instead of a blank page and no download, I get a grey blank page with download.php at the top-left and some navigation buttons at the bottom-right. Again with no download.
I went back and tried another page with another contact form and same result. Underneath the ‘download.php’ the blue line width is different each time I pressed reload but it never downloaded anything.
The download works for Firefox and other browsers — just not Chrome.
What you’re seeing is some sort of bug with Chrome’s built-in PDF viewer or with Chrome itself in how it handles files sent with a correct mime type (like “application/pdf”) but from a program (like download.php) or from a program with a query string on the end of the URL.
One other person on here ran across the same problem a few weeks back. Also, I have been able to reproduce the problem on my own server. There are a couple of ways around it, though none are perfect.
Option A
This is a little complicated…. So, the problem does NOT occur if the PDF is sent from the server with headers that cause Chrome to cache the file in its browser cache. This is why many people do not see the problem. There are a couple of exceptions to that. First, if the user has disabled his browser cache in his preferences (or in Developer Tools or via plugin) then the problem will occur. Also, if he reloads the page by holding the Shift key and clicking the reload icon then that bypasses the browser cache and thus causes the problem to appear. Ok, so what all that means is that the URL with the download.php?somelongstringofcharacters WILL work for almost everyone as long as you setup headers to cause the pdf file to make it into the browser’s cache. On your site, you are sending back an Expires headers that is some date in 1980. Thus, the browser cannot cache the file. If you instead set the Expires header for PDFs to be a month from the time the file is accessed or a year from the time the file is accessed, then it will probably work. That said you have quite a few cache-related headers that I don’t recognize or that I don’t remember being valid for Response headers (as opposed to Request headers), so you might need to do more than what I just said. Anyway, if none of this makes any sense, then you probably don’t want to go this route. If it does make sense then you can try fixing your Expires header and that might be enough. In Apache, if you have mod_expires going, then you’ll need a stanza like
ExpiresByType application/pdf A31536000
which would expire the pdf a year from now. Obviously don’t set it that far out if you plan on changing the content of that pdf and keeping the same filename. I think you’ll need:
ExpiresActive on
as well, if you don’t already have it.Option B
If you add:
force_download=”true”
to your shortcode, then instead of trying to display the PDF inside Chrome using the internal PDF viewer, it will instead pop up a file save box and allow the user to save the pdf file. That will avoid the problem, but might not be what you want. I think modifying the shortcode is enough to make it do the file save box, but if it doesn’t then also turn of hide/mask.Option C
If you turn off hide/mask in the EBD settings and you put your download file in an accessible directory then EBD will do a “Location:” to the file location rather than trying to read the file & send it to the browser using php. By doing a Location: the browser will go get the pdf file and it will display properly. However, the user will be able to see what the URL to the file is once it shows up in the PDF reader. That may not matter to you .. if not, then this is a good solution. Earlier when I said you have to put the download file in an “accessible directory”, what I mean is that your pdf file is probably in dlm_uploads (which is where Download Monitor put it when you uploaded it). However, dlm_uploads may be protected so that people on the net can’t get to it. If so, then can copy the pdf over to like the regular uploads directory and then modify the URL path in Download Monitor for that download so that it points to the new location).
just as a side note, Chrome users and the developers have been mucking around with how Chrome handles file downloads and the built-in viewers and stuff for several years. I suspect they fixed one thing (like https://bugs.chromium.org/p/chromium/issues/detail?id=104331 ) and broke this. As far as I know, there is no open bug to fix this problem … it’s so difficult to explain and to show to people that I doubt anyone has bothered, though I could be wrong.
Got it. The ‘Hide/Mask Real Link’ option in the EBD settings was the last problem. I was looking into your Option B and unchecked it and the pdf downloaded immediately. Force download isn’t necessary in the shortcode.
I’ll have to do some more extensive testing on other forms with the other things we’ve updated and confirm.
Thanks so much!
I have same problem with download, but not when unchecking ‘Hide/Mask real link’.
Seems Chrome and plugin does not agree on this matter.
PS. If user right click and choose Save as, then the download works for me, in Chrome and with Hide/Mask real link checked.
You can try to “force” the download, which will cause the file save box to popup as if someone had right-clicked.
Go into your Downloads (the Download Monitor section of your wordpress menu). Edit whatever your download is so you’re on the detail page. Over on the right side will be a checkbox for something like “Force Download”. Check it (or uncheck it if it’s already checked). Test again. If it still doesn’t work change the hide/mask setting and try again.
Note that testing this is really tricky. There is a difference in how Chrome works or doesn’t work, depending on whether or not the PDF is in your browser’s cache or not (and possibly how recently it got in there). That is probably why you are sometimes seeing it work and sometimes hang. I suggest you clearing your cache & exiting & restarting your browser every single time between tests. That way you will be certain to never have anything cached and a clean browser every time you test. Otherwise, you won’t really know what works & what doesn’t….
the same problem with@henriklarsen,could you pls do any help?
[Link redacted]
Probably not the same problem. Please open a new item & give a full description of the problem, including whether or not it ever worked before and a link to the page with the EBD form on it.
I will go ahead and mention a couple of things here in this item, but open a new item to continue this….
I can tell from the link to the download you provided that it can’t find the file on the filesystem because it is returning a 302 Temporarily Moved and giving a Location: header and there is no URL next to the Location: which is definitely incorrect.
You probably moved things around somehow — like from a previous hosting provider to a new one, or you moved files around in the filesystem, or you uploaded the file into the wrong place (you should upload into Download Monitor, which is the “Downloads” link on your wordpress main menu), or something like that.
You might be able to get it work by checking or unchecking “Hide/Mask” setting, but most likely you’ll need to do something to make the file get found (put the file in the correct location, delete it & reupload it, etc).
@dtynan,thank you,problem solved!
Hello, My chrome is hanging with the pugin. I tried all the recommended suggestions above, forced download in shortcode, turned off hide/mask (never was activated in the first place), check to make sure that the downloads are forced (unchecked, but the box was never check).
Works fine in Safari and Firefox, but it just idles in Chrome.
Anymore suggestions on what I could do to get it going.
- The topic ‘Email before download just hangs after clicking link’ is closed to new replies.