You will usually see this error in your browser because your PDF does not sit on the same domain as the current page on your site.
For example, if you access the page http://www.example.com/
and see the error message:
Failed to Fetch while retrieving PDF “http://example.com/wp-content/uploads/mydoc.pdf”
this is because the shortcode for the embedded document references the URL on example.com
whereas the page is sitting on www.example.com
.
The www
part is important – it references a different domain to the PDF’s URL that does not contain www
.
This error can also occur if an SSL certificate has been incorrectly installed where the admin side of the site is under HTTPS, but the front end of the site is under HTTP protocol or vice versa.
For security reasons, browsers are not allowed to load the PDF from a different domain. This error will also occur if you try to embed a PDF from another 3rd party site.
You will need to ensure all your [pdf-embedder]
shortcodes refer to the PDF’s URL in the new preferred manner.
Sometimes, the problem might be that WordPress is configured to upload PDFs to media.example.com
, or something similar, perhaps due to a content-delivery plugin that is attempting to speed up your site. It may still be possible to load PDFs hosted on a different domain, at least if you have the ability to set up the configuration of that domain – see Hosting PDFs on other services such as Amazon S3.
It is also possible that a PDF URL is being prevented from loading by a browser Ad Blocker. In the browser console, this shows up as an error net::ERR_BLOCKED_BY_CLIENT
. To fix this, be sure that the PDF file name does not contain any words like this:
- advertisement
- advert
- ad
- click
- doubleclick
which are trigger words for various Ad Blockers.