Skip to main content

Posts

Showing posts with the label JavaScript Codes

Imgur API Image Uploader using JavaScript (+ HTML)

Source :- https://compile.blog/imgur-api-image-uploader/ See Example :- https://sh20raj.github.io/Gurimg/ Video Documentation :- https://youtu.be/Gh1ngxdIXAk {% youtube https://youtu.be/Gh1ngxdIXAk %} Codepen Demo :- https://codepen.io/SH20RAJ/pen/QWqoOrL Imgur is great for hosting images for free. There are other platforms like FileStack, Cloudinary, and UploadCare; but among all Imgur is the best for uploading images because it’s free for non-commercial usage. And, there is a simple way to set up the Imgur API to upload images directly from the local disk. Here’s how to do it: Imgur API Image Uploader Let’s break it into simple baby steps: Step #1 – Get the Imgur API First of all, you will have to register your application with the Imgur API. Go to the API page and register an application. It should look like the below screenshot: Fill in the following details in the respective fields: Application name: whatever you would like to name it Authorization type: OAut

Figure out if the device is a mobile or a desktop/laptop Using JavaScript

detectDeviceType() this function will return you a string value either "Mobile" or "Desktop".   const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? 'Mobile' : 'Desktop'; // Example detectDeviceType(); // "Mobile" or "Desktop" See Demo on Codepen :- See the Pen Figure out if the device is a mobile or a desktop/laptop Using JavaScript by SH20RAJ ( @SH20RAJ ) on CodePen .

Random Posts