Im NOT the expert and this is by no means an exhaustive list, but here's a few tips ive picked up over the years that you might find useful. Feel free to add
- Pre-Connect to other domains If your pulling a lot of images/resources from another domain then use the rel="peconnect" link in your header to tell the browser to establish a connection with that domain as soon as the page is loaded and then use that connection to fetch your images. Rather than opening up a new http port for each image.
Code: Select all
<link rel="preconnect" href="https://otherdomain.com">
- DNS-Prefetch to other domains For less critical resources (or for browsers that dont support preconnect), you can use rel="dns-prefetch" which resolves the domain name to an IP address ready to open a port when needed. Yes you can pair both preconnect and pre-fetch so if preconnect isnt supported, it will pre-fetch the domain instead.
Code: Select all
<link rel="preconnect" href="https://otherdomain.com"> <link rel="dns-prefetch" href="https://otherdomain.com">
- CSS at the top, Javascript at the bottom The browser needs to process your CSS file first in order to display the page so link to that in your <head> tag. Most of the time, javascript is NOT needed to display the page so you can link to that at the bottom of the page. You can also use the defer keyword to defer loading until the page is finished
Code: Select all
<script defer src="myjavascript.js" type="text/javascript"></script>
- Specify image dimensions Wherever possible, you should specify your image dimensions, either via CSS or in the html itself. Otherwise the browser has to load the image before it can work out how much space to allow for it. This leads to the page jumping about as it loads (called Cumulative Shift) and really degrades the user experience and slows down the page
- Lazy Load EVERYTHING Wherever possible, you should lazyload your images/iframes. This simply means that the image isnt loaded until the user scrolls it into view which massively speeds up page loading. There's lots of scripts that do this. A good simple one to use is https://github.com/aFarkas/lazysizes
- DONT Ajax load the top of your page A lot of sites do this, often its a banner rotator or similar script that loads content into view at the top of the page (ie above the fold). There's a big problem with this, the page has to fully load first AND process all the javascript before it can make yet another call to dislay the banner/content via ajax. All the while, the user is left staring at a big blank space on the screen. Keep ajax for out of view stuff
- Mobile First CSS Generally speaking, mobiles run on a slower connection than desktops so your css should always layout the mobile screen first and then only load the desktop css if its needed. You can use css media queires to do this
- Minimise your files Use an online minifier like https://www.minifier.org/ to minimise your code
- Test your pages You can use google's Pagespeed Insights to analyze your page. Another handy tool is GTMetrix
In the adult industry, page speed is critical. Its the most competitive industry on the planet and often you only have a split second to engage the user before he switches to another site. A slow site will massively drive up your bounce rate
Hope somebody finds this useful


