Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pdf file

Featured Replies

I'm trying to find a way so when a user clicks on a link to pdf file it doesn't open but triggers the download action in the browser

 

from what I've read I need to add an extra http header but I'm not too sure where this would be added or is there another way

 

thanks

  • Author

I ended up using php in the end

 

here's the code I used if its useful for anyone I put the pdf in the same folder as the php and then added the name of the php file before the pdf in the link

 

example href="forms/file.php/file.pdf"

 

 

 

<?php

$pdf = substr($_SERVER['PATH_INFO'], 1);

if(preg_match('/^[a-zA-Z0-9_\-]+.pdf$/', $pdf) == 0) {
print "Illegal name: $pdf";
return;
}

header('Content-type: application/pdf');
header('Content-disposition: Attachment; filename=' . $pdf);
readfile('path_to_pdfs' . $pdf);
?>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.