Page MenuHomeWildfire Games
Paste P254

Wordpress os detection scrip
ActivePublic

Authored by Stan on Aug 8 2021, 12:30 PM.
<script type="text/javascript">
// <![CDATA[
var OSName = "Unknown OS";
if (navigator.platform.indexOf("Win") !== -1)
{
OSName = "Windows";
}
if (navigator.platform.indexOf("Mac") !== -1)
{
OSName = "MacOS";
}
if (navigator.platform.indexOf("Linux") !== -1)
{
OSName = "Linux";
}
if (OSName.indexOf("Windows") !== -1)
{
document.getElementById("dl-page-button").innerHTML = 'Download for Windows &raquo;';
document.getElementById("dl-page-button").href = 'win';
}
if (OSName.indexOf("MacOS") !== -1)
{
document.getElementById("dl-page-button").innerHTML = 'Download for macOS &raquo;';
document.getElementById("dl-page-button").href = 'mac';
}
if (OSName.indexOf("Linux") !== -1)
{
document.getElementById("dl-page-button").innerHTML = 'Download for Linux &raquo;';
document.getElementById("dl-page-button").href = 'linux';
}
// ]]>
</script>

Event Timeline

Stan created this paste.Aug 8 2021, 12:30 PM
Stan created this object with visibility "Public (No Login Required)".