Search code examples
htmltexthyperlinkhref

Prevent browser from downloading linked file


<a href="/scripts/script.pde" target="_blank"></a>

I want the browser to display this file as text in a new window. When clicked, it downloads onto the user's computer.


Solution

  • You need to tell your server how to hand out those files. In Apache, you would do this in your config:

    AddType text/plain .pde