Index » Extras » Code » Miscellaneous
Updated 5/4/23

Copyable code - Miscellaneous

Iframe links open in parent window

<head> <base target="_blank"> </head>

Timed redirect

<head> <meta http-equiv="refresh" content="2; url=URL_GOES_HERE" /> </head>

Random YouTube embed

<script> var videos = [ "https://www.youtube.com/embed/5HO70-Rk3jE", //troops fan film "https://www.youtube.com/embed/yPmF_2etYrA", //japanese game show boxes "https://www.youtube.com/embed/nB8tiSMCwRE", //mark of zorro swordfight "https://www.youtube.com/embed/-rsEs4HWXeY", //big bills hells cars "https://www.youtube.com/embed/hyCIpKAIFyo", //animusic "https://www.youtube.com/embed/IG2JF0P4GFA", //quaaludes "https://www.youtube.com/embed/0lgjmXw7_Oo", //the real new hope "https://www.youtube.com/embed/Hlcp-3Bl4M0", //civil protection aliens "https://www.youtube.com/embed/OHxyZaZlaOs", //half life full life consequences "https://www.youtube.com/embed/fqApb5YT-GM", //penguin slap debunk "https://www.youtube.com/embed/U_X5uR7VC4M", //you suck at photoshop "https://www.youtube.com/embed/u-ef8SD9gUg", //docfuture sonic "https://www.youtube.com/embed/ZE9eJHzTBOI", //want to kill your pc "https://www.youtube.com/embed/lTU-pyQ_anQ" //kirby xp ]; window.onload = function () { var playerDiv = document.getElementById("randomyt"); var player = document.createElement("IFRAME"); var randomVideoUrl = videos[Math.floor(Math.random() * videos.length)]; player.setAttribute('width', '320'); player.setAttribute('height', '240'); player.setAttribute('src', randomVideoUrl); player.setAttribute('frameBorder', '0'); playerDiv.appendChild(player); }; </script> <div id="randomyt"></div>

Result:

(w3schools forums, stackoverflow)

Picture randomizer

The above code can be modified to create a randomizer for pretty much anything.

<div id="banner"><script> var images = [ '<a href="https://www.youtube.com/embed/ZE9eJHzTBOI?start=19"><img src="/links/images/media37416.gif" alt="Congratulations!"></a>', '<a href="https://rs-archive.neocities.org/"><img src="/links/images/rs-archive.gif" alt="Runescape Archive"></a>', '<a href="https://zapatopi.net/treeoctopus/"><img src="/links/images/treeoctopus.png" alt="Research Tree Octopus"></a>', '<a href="https://www.youtube.com/watch?v=6POFCs-AOUQ"><img src="/links/images/PS2FREE.gif" alt="Get a PlayStation 2 for free!"></a>', '<a href="https://acoustica.com/mixcraft"><img src="/links/images/mixcraft.png" alt="Mixcraft, Multi-Track Recording Studio"></a>', '<a href="https://boodlebox.neocities.org/blinkexchange/blink.htm"><img src="/links/images/blinky6.gif" alt="Internet Blink Exchange"></a>', '<a href="https://boodlebox.neocities.org/blinkexchange/blink.htm"><img src="/links/images/blinky3.gif" alt="Internet Blink Exchange"></a>', '<a href="https://boodlebox.neocities.org/blinkexchange/blink.htm"><img src="/links/images/big1.gif" alt="Internet Blink Exchange"></a>' ]; var randomImage = images[Math.floor(Math.random() * images.length)]; document.getElementById("banner").innerHTML = randomImage; </script></div>

Result:

DuckDuckGo or Google powered search bar

Of course this relies on search engines outside your control indexing your site, but it's very easy to implement.

<form method="get" action="https://duckduckgo.com/" target="_top"><input type="text" name="q" placeholder="Search"><input type="hidden" name="sites" value="https://slimysomething.neocities.org/"><button type="submit">Go!</button></form>
Result:
<form action="http://www.google.com/search" target="_blank"><input type="text" name="q" placeholder="Search"><input type="submit" value="Go!"><input type="hidden" name="sitesearch" value="https://slimysomething.neocities.org/"></form>
Result:

(DuckDuckGo search for your website)

Steal music from Dailymotion

.player { position:relative; width:40px; height:40px; overflow:hidden; } .player iframe { position:absolute; left:-131px; top:-55px; } .player img { position:absolute; left:0; top:0; pointer-events:none; z-index:1; } <div class="player"> <img src="images/headphones.gif" alt="music player"> <iframe src="https://www.dailymotion.com/embed/video/x1mtbfh?autoplay=true&ui-highlight=c90c0f&mute=0&queue-autoplay-next=false&sharing-enable=false&ui-logo=false&ui-start-screen-info=false&queue-enable=true"></iframe> </div>

Result:

music player