URL Shortener, you might have used one of them in your life such as bit.ly, goo.gl and much more. They are useful for shortening long URLs so tha...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for sharing! I've never heard of jsonstore.io, seems like a great product to use for quick prototyping.
If I could give you some pointers on your code, try and be consistent in the naming conventions you are using on methods and variables. Right now it seems like you sometimes use snake casing, like
protocol_ok
andsend_request
, while most of the time you don't case at all, likegenhash
orgetrandom
. Imagine them all being likeor if you prefer snake casing:
This reads a lot easier right. Try and remember writing the code so it's easy to read for others, and you'll see your code becoming cleaner and cleaner.
Thank You, I'll keep these in mind
Great one. It's much easier to create your own URL shortener with Netlify. See my post: How to Create Your Own Private URL Shortener for Free
Really? You pull jQuery in for an ajax request?
I would recommend to just use fetch instead, as it is build into most browsers. If you are concerned about browser compatibility, use a polyfill.
Ah, I'll look into it soon to make it better.
Thank You
For Sending Json Request, I created a function with XMLHttpRequest() (Code)
(Actually I have changed the storage provider so APIs are little different but understandable)
First, we open a new connection to your storage provider, then tell them that we are going to send json data.
Then create a JSON Object something like this
{"l":<LONG_URL> , "s": <SHORT_URL_SLUG>}
then send the json object to my JSONBOX endpoint (yes, I have switched to jsonbox from jsonstore).I'm curious why you're not using the more widely used
const
andlet
syntax tbh, it makes the code much clearer in my opinion and you have to worry less about scoping.Also, have you tried the new Fetch API? It's much easier to work with than Ajax
Agree with you 👍.
Actually I'm thinking of rewriting this article after my exams.
thank you and congratulations!
I'm also building a
url shortner
(with Go to study) and I did not know aboutjsonstore.io
, here is the project; github.com/rafa-acioly/urlshorI checked you repo. Great Idea!
Actually I have plans for rewriting this month. I hope it will be soon.
I have only used jQuery for sending and fetching json requests. Which could be easily converted to Vanilla, infact I didn't use jQuery for the production. Meanwhile You can check that out the source and find your answers
bauripalash / fossurl
Your Own Url Shortner Without any fancy server side processing and support for custom url , which can even be hosted on GitHub Pages
🌐 Open fossurl.ml
What is Fossurl
Fossurl is an simple URL Shortener Which Can Be Hosted For Free in Github/Gitlab Pages or in Static Site Hosting Service and It doesn't need you to buy any server!
Implementing a Simple URL Shortner which can be used without need of any hardcore server side processing and can be hosted on Static Site Hostings such as GitHub/Gitlab Pages
Steps:
cd
tosrc
direcotory and on Windows do whatever it's neccesary to change directory tosrc
how to see the stats of the short url?
clicks, demographics, utm builder etc?
Not implemented yet!
Great article. My only question is how do you guarantee the short url is unique with the getRandom function? How many unique urls do you think the algorithm can provide?
It's just simple guide , I've not made it complex, to let beginners understand the code easily.
Here's the production code,
bauripalash / fossurl
Your Own Url Shortner Without any fancy server side processing and support for custom url , which can even be hosted on GitHub Pages
>Working Demo<
Current Version : 2.0 beta
Implementing a Simple URL Shortner which can be used without need of any hardcore server side processing and can be hosted on Static Site Hostings like GitHub/Gitlab Pages
TODOs:
Shorten via api [Work in Progress]
Add Custom URL Supoort [DONE]
⚠ Warning
Please Don't Use FossUrl to shorten any sensitive Information , important files or any other sensitive things which can create privacy issues for an individual or a company or an organisation.
Licence : MIT
Logo License :
Please Contribute😊
If You Like My Work Consider
…+1 for jsonstore.io! thanks a lot for the tip! :)
Yes, jQuery was only used to send and fetch data from Jsonstore. But in present I ditched both jQuery and Jsonstore.