I know I can do the following to generate a json (or in similar fashion, xml) page:
<?php
header('Content-type: application/json');
echo (file_get_contents('some.json', true));
?>
However, I need the user to be able to go to file->save and have that default to a .json (or .xml) extension (not a ".txt" or ".php" or whatever their browser defaults to).
Is this even possible in php or in javascript? Perhaps there's a way to mod the url? ex: g.co/index.php BECOMES http://ift.tt/1sghyYa OR g.co/some.json so the bowser can default properly.
No comments:
Post a Comment