2018-11-25 23:43:54

so I've learned how to html a decent bit, and it's easy! but how do i make it download things? If i, for example, link to a bgt script, it just opens the bgt script in notepad basically on a page, does it have to be a zip file or exe file for it to directly download? and with audio files, does it automatically play if i link to it, if it's just on my cmputer and i haven't made an audio player or whatever? thanks for help, and soon the site i'm making should be up!

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2018-11-26 00:03:46

Add the download keyword, like this:
<a href="bob.bgt" download>My link</a>

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2018-11-26 00:21:54

ok thanks

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2018-11-26 04:06:42

Thanks Darter, I actually didn't know about that one. That's quite helpful.

I've been going by Bryn, which is now reflected in my profile. Please do your best to respect this :) Mess ups are totally OK though, I don't mind and totally understand!
Follow on twitter! @ItsBrynify
Thanks, enjoy, thumbs up, share, like, hate, exist, do what ya do,
my website: brynify.me

2018-11-27 18:43:15

ok another question, how do i make links go to a certain specific part on a page like in swamp's readme where it's in an html file and it has links in the table of contents that take you directly to that heading?

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2018-11-27 19:14:56 (edited by Ethin 2018-11-27 19:22:31)

That requires you to do two things: assign header IDs and link to them.
First, assign header identifiers/names to each heading level, like so:

<h2 id="introduction">Introduction</h2>

The id attribute is the one you want to add to your element declaration. Do that for all of your heading levels you want to link to, then:

<a href="#anchor-name">description of link</a>

The #anchor-name is what you want to replace, so for this example I'd do:

<a href="#introduction">Introduction</a>

Some other interesting tips/tricks:
Define details that the user can click to show or hide:

<details [open]>
details here
</details>

Group related elements in a form:

<form [attributes]>
<fieldset [disabled] [form="form_id"] [name="name"]>
<legend>description:</legend>
...
<legend>description:</legend>
...
<legend>description:</legend>
...
...
</fieldset>
</form>

Define navigation links (usually auto-generates a landmark):

<nav>
<!--links-->
</nav>
"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2018-11-29 00:06:13

If you want, you can also use PHP for download.
Here's the example:
PHP script:
<?PHP
//Define file location. If file exist in php script location please not writing something.
$filePath = "";
//Define filename. If file with this name dont exist browser can download a blank file.
$fileName = "catsaresoft.mp3";
//Please do not modify other lines.
$fd = fopen($filePath.$fileName,"r");
$size = filesize($filePath.$fileName);
$contents = fread($fd, filesize($filePath.$fileName));

fclose($fd);

header("Content-Type: application/octet-stream");
header("Content-Length: $size;");
header("Content-Disposition: attachment; filename=$fileName");

echo $contents;
?>
After filling variables, please add link to file in html for example:
<a href="file.php">Download file about cats</a>

Mao!
--
TD programs website available under new address.
https://tdprograms.ovh/

2018-11-29 03:43:59 (edited by Ethin 2018-11-29 03:44:18)

I don't understand what makes the code in 7 much different from using the download attribute. For one, that method is inefficient and requires the size of the file in bytes of memory available because your reading the entire file into memory. And that risks going over the memory limit that PHP sets. And, two, your opening it in "read" mode, not "read-binary" mode. No point in adding code that's pointless when the download attribute is there in HTML.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2018-11-29 14:22:25 (edited by redfox 2018-11-29 14:22:57)

also, i'm not using php or anything except html, unless i need to

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)