How to validate a YouTube url using JavaScript

validate a YouTube url using JavaScript

Here is a little code snippet to help you validate a value to ensure it's a YouTube url using JavaScript.

This regex here will ensure that the url supplied matches the criteria of a valid youtube url:

  • This is that it is from www.youtube.com or youtu.be
  • That it contains either a 'v=' querystring or has the id as part of the url supplied
  • It also makes sure that the id is 11 characters long.

How to setup HTTPS on your site in under 5 minutes

how to setup https on your website in under 5 minutes using CertifyTheWeb

Now that Google Chrome 68 is out, there is more of a focus on unsecured websites than ever before. Rather than highlight when a website is secure with a SSL cert, Google is taking the opposite approach and going off the basis that every site should have a SSL cert installed. Now when you browse to an unsecured site, .i.e. a normal http website, it will highlight that site as being unsecure.

how chrome 68 will display a secure website and an unsecure website

How to fix MS Teams continuously trying to log in after you update your PC password

fix for MS Teams login loop issue

We use MS Teams in work and after using it for close to 12 months it really has won us over from Skype. It did take a little bit to get used to the idea of 'conversation threads' and not just random chats but once you get used to it, you'll never go back

However, there is one issue that a few of us have run into where Teams would just keep showing the 'Logging you in' modal when starting up after we change our system passwords. This would happen even if you logged out of the current Windows session or rebooted the PC.

How to extract a YouTube video id from a url

how to get the video id from a youtube url

If you're allowing customers to save YouTube videos on your site and you'd like to extract out the video id when storing into your database you could try using either of these options below.

The thing to remember is that the YouTube url can be either:

  • Youtube.com
  • Youtu.be

and the Video Id can be appended as a querystring parameter or as the last segment of the url:

  • YouTubeUrl?v=videoId
  • YouTubeUrl/videoId

Tips to help improve Evernote desktop performance

tips to help improve Evernote desktop performance

I use Evernote every day in work. I'd be lost without it. The ability to quickly search for answers for my day to day tasks or to write down some development ideas for later use makes it one of my daily 'go to' tools.

There are of course loads of other note taking apps out there, many of them free too, but for me Evernote wins out because of how my data is organized and the quality of the search results. Some of the features I rely on are paid features but I use the app literally every hour of my working day so can easily justify the cost/benefit.

Compared to some users out there I would have what would be termed a 'small' collection of notes. At present it's around 500 individual items - mostly text but some of these will have images or screenshots. I noticed that every now and then Evernote will slow down and a little spring cleaning is in order to help it out.

I've found that running the steps below can really help out with the performance of Evernote. If you ever find yourself starting at the app while it's not responding when you do a simple search or if the app is freezing for a few seconds when opening notes these tips could come in useful.

Allow Chrome to view blocked page due to cert error

Allow Chrome to view previously blocked page due to a cert error

If you're using Chrome to develop locally over https but your site cert is invalid you might have come across an issue where Chrome will block access to your website.

UIsually you can click on the 'Process to site' link that Chrome gives you but if you don't see that link you might have to delete any previously saved security policy information you had saved.

Get In Touch

Follow me online at TwitterFacebook or Flickr.

You can also contact me by email.

Buy Me A Coffee

Latest Tweets


Buy Me A Coffee