This page has two sounds, triggered by, respectively, a button and an image, that use JavaScript to play the sound.
The sound players are still embedded, but the embedding and the playing of the sounds are accomplished with JavaScript. The JavaScript functions are specified in an external file (named 'sounds.js') on the server and are not displayed when the user views the page source.
Furthermore, only part of the file name for each sound file actually appears in the page source. The full file name is assembled by JavaScript but the user never sees it. This means it is no longer very easy for the casual user to capture your sound files.
Although there is an embedded player for each sound, we have made it invisible by giving it zero height and width. So now there is nothing to right-click. I believe this will prevent owners of QuickTime Pro or similar players from easily saving your files to their computers.
Peace be unto you.
| السلام عليكم |
And unto you be peace.
| و عليكم السلام |
|
/* * * * * * * * * * *
*
* Javascript functions for embedding and playing sound files in a web page.
*
* by George Saxton, March 2011
*
* * * * * * * * * * */
function EmbedSound(filename,id) {
if (!document.getElementById(id)) {
// Create a new embedded sound.
embed = document.createElement("embed");
embed.setAttribute("src", "prot/"+filename+".mp3");
// embed.setAttribute("hidden", "true"); // This attr makes the Button fail!
embed.setAttribute("height", "0"); // So we hide the element by
embed.setAttribute("width", "0"); // giving it zero height & width.
embed.setAttribute("autostart", "false");
embed.setAttribute("enablejavascript", "true");
embed.setAttribute("id",id);
document.body.appendChild(embed);
}
}
function PlaySound(soundid) {
var sound = document.getElementById(soundid);
sound.Play();
}