Menu

Want to work with us? We're on the lookout for a talented Digital Project Manager.

We're hiring

Short youtube urls not working with prettyphoto

Web Bureau


03 November 2011 by Web Bureau

This is a simple solution to help over come issues with users entering the short url's for youtube videos, which isn't compatibile with many jquery libraries out there.

Basically this function detects wether the url entered is a short url and if so re-writes the url to the long version.

Public Function fun_FormatYouTubeUrl(ByVal Url As String) As String

        Dim value As String = String.Empty

        Try
            If InStr(Url, "http://youtu.be/", CompareMethod.Text) Then
                value = "http://www.youtube.com/watch?v=" & Replace(Url, "http://youtu.be/", "")
            Else
                value = Url
            End If

        Catch ex As Exception

        End Try

        Return value

    End Function 

 No more problems with prettyphoto not working with youtube url's.

 

Grow your businessStart a project with us today.