How to force downloads on mobile
-
Ever since the MIME app was deprecated in cPanel – the ability to force downloads on mobile has been less than stellar.
I’ve added the MIME type to my htaccess file ‘AddType audio/mpeg .mp3’ but that had no effect.
Later I learned that adding content-disposition to a php file was the solution but it’s not. This is what I came up with:
` header(‘Content-Type: audio/mpeg .mp3’);
$file_name = ‘file.mp3’;
$file_url = ‘https://partyfavorz.podbean.com/’ . $file_name;
header(‘Content-Type: application/octet-stream’);
header(“Content-Transfer-Encoding: Binary”);
header(“Content-disposition: attachment; filename=\””.$file_name.”\””);
readfile($file_url);
exit;’I also tried adding it to the functions.php file of my child theme but that forces a download automatically even when you go to my homepage without clicking on anything.
My podcast is subscriber based so it requires a username and password to login to stream or download. A box pops up asking for the information and then it works. I just want the file to download automatically once the subscriber is logged in and clicks on the download button, which works fine on desktop but not on mobile.
On mobile – it takes you to a black player that attempts to load before finally displaying the default WordPress player with three vertical dots you must click and then click again to download.
Other than the fact that the average user doesn’t have the knowledge to do that because it’s not the expected behavior – it’s also inconvenient.
Stack Overflow appears to not really be engaging with anyone for solutions at the moment and I’ve already performed considerable research to find the correct solution to no avail.
My question is would it be possible for Powerpress to write a line of code that’s standard with the default WordPress player for downloads automatically on mobile devices without having to jump through all these hoops to find a solution that’s either too complicated for a self-taught coder like myself or frankly doesn’t exist. It would sure be nice and increase user engagement.
Your player and integration is so useful – I’d even be willing to pay a yearly subscription fee just for the privilege of using it even though I don’t use the Blubrry service (no offense).
The sample page I provided is a free download with no login required so when you click on the download link – it should just download automatically on mobile but it still takes you to a separate WordPress player mentioned above to download.
The page I need help with: [log in to see the link]
- The topic ‘How to force downloads on mobile’ is closed to new replies.