Sandbox: Difference between revisions
From Hidden Mickey Wiki
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<script> | |||
(function() { | |||
// Detect Mac desktop | |||
var platform = navigator.platform.toLowerCase(); | |||
if (platform.indexOf('mac') !== -1) { | |||
// Show a Hello World alert | |||
alert("Hello World – Mac desktop detected!"); | |||
// Or add a message on the page | |||
var msg = document.createElement('div'); | |||
msg.textContent = "Hello World – Mac desktop detected!"; | |||
msg.style.color = 'red'; | |||
msg.style.fontWeight = 'bold'; | |||
document.body.prepend(msg); | |||
} | |||
})(); | |||
</script> | |||
Revision as of 09:46, 2 October 2025
<script> (function() {
// Detect Mac desktop
var platform = navigator.platform.toLowerCase();
if (platform.indexOf('mac') !== -1) {
// Show a Hello World alert
alert("Hello World – Mac desktop detected!");
// Or add a message on the page
var msg = document.createElement('div');
msg.textContent = "Hello World – Mac desktop detected!";
msg.style.color = 'red';
msg.style.fontWeight = 'bold';
document.body.prepend(msg);
}
})(); </script>