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 = [ "", //troops fan film "", //japanese game show boxes "", //mark of zorro swordfight "", //big bills hells cars "", //animusic "", //quaaludes "", //the real new hope "", //civil protection aliens "", //half life full life consequences "", //penguin slap debunk "", //you suck at photoshop "", //docfuture sonic "", //want to kill your pc "" //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>


(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=""><img src="/links/images/media37416.gif" alt="Congratulations!"></a>', '<a href=""><img src="/links/images/rs-archive.gif" alt="Runescape Archive"></a>', '<a href=""><img src="/links/images/treeoctopus.png" alt="Research Tree Octopus"></a>', '<a href=""><img src="/links/images/PS2FREE.gif" alt="Get a PlayStation 2 for free!"></a>', '<a href=""><img src="/links/images/mixcraft.png" alt="Mixcraft, Multi-Track Recording Studio"></a>', '<a href=""><img src="/links/images/blinky6.gif" alt="Internet Blink Exchange"></a>', '<a href=""><img src="/links/images/blinky3.gif" alt="Internet Blink Exchange"></a>', '<a href=""><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>


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="" target="_top"><input type="text" name="q" placeholder="Search"><input type="hidden" name="sites" value=""><button type="submit">Go!</button></form>
<form action="" target="_blank"><input type="text" name="q" placeholder="Search"><input type="submit" value="Go!"><input type="hidden" name="sitesearch" value=""></form>

(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=""></iframe> </div>


music player