Web Optimization
Web Optimization
From the above example we can make our images more responsive
Another thing is we can reduce our images size by compression because of that
it may increase our page responsive time. It will help us to improve our website
responsiveness.
Before image compression the responsive of the website is :19.87 sec.
Because of decreasing responsive time it will increase the number of users and
it will improve our rank in google analytics ranking.
And another thing is by changing formats of images to JPEG(joint photographic
experts group) it’s a lossy compression but it is most recommended format for
images to implement in our website. And it is having typically many different
colors and gradients.
And we will use GIF(graphic interchange format) and png for logos and icons
<script src="ex1.js"></script>
</body>
</html>
const colors = document.querySelectorAll(".color");
colors.forEach((color) => {
color.addEventListener("click", () => {
const colorValue = color.style.backgroundColor;
console.log(`This color is ${colorValue}`);
});
});
By using dom in our website it will increase our web performance and it will
effect our website performance.
<button onclick="loaddata()">weboptimization1</button>
<button onclick="loaddata()">weboptimization2</button>
<button onclick="loaddata()">webopitmization3</button>
<script>
function loaddata()
{
var xhttp=new XMLHttpRequest();
xhttp.onreadystatechange=function()
{
if(this.readyState==4 && this.status==200)
{
document.getElementById("demo").innerHTML=this.responseText;
}
else if(this.readyState==4 && this.status==404)
{
document.getElementById("demo").innerHTML="File not found";
}
}
xhttp.open('GET',"ex3.html",true);
xhttp.send();
</script>
</body>
</html>
Because using ajax in our website it will reducing the rendering time in our
website because of that it will reduce our website performance. usually we use
AJAX to send data asynchronously to the server and display the result that we
get from the server without making the users wait (or less time to wait in
practical) for data.