Back to Blog
Create a tinyurl6/6/2023 ![]() When we click this button, our long URL will be shortened as it has an onclick function which will be executed when we click the button. I gave it an id name urlinput so it would be easy to access in the JavaScript. The first element is input where we will type/paste our long URL. Inside the body tags, there are only three elements: an input, a button and a script. So let’s start adding our three main elements: Short The URL Īs I showed you in the above code, I’ve created a simple HTML file. We’ll need only a text input box, a button, and a script tag to create our URL shortener.įirst create an HTML file called index.html, as there is only a need for those two elements (a text input box and a button). So without further ado, let’s start building. I’ll be assuming that you already know some basic HTML & JavaScript. Today, we’ll be building a simple URL shortener which does not need a database system to host it. To understand how, we need to take a closer look at an URL shortener - so we’ll be building a simple one! With that task, we’ll be learning some new things as well as understanding how a URL shortener works. You might be wondering how these things work. They are useful for shortening long URLs so that you can easily share them with your friends, family or co-workers. You might have used a URL shortener before, such as bit.ly, goo.gl. By Palash Bauri How to build a simple URL shortener with just HTML and JavaScript
0 Comments
Read More
Leave a Reply. |