Posts

Showing posts from February, 2018

HTACCESS FOR URL ROUTING FOR ANGULAR 2 APPLICATION

/*HTACCESS FOR URL ROUTING FOR ANGULAR 2 APPLICATION*/ RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d RewriteRule ^ - [L] # If the requested resource doesn't exist, use index.html RewriteRule ^ /index.html

Get the YouTube video ID from YouTube video URL Using Javascript

Use the below function to get the YouTube video ID from YouTube video URL /** * @param video_url String YouTube video link * @return String YouTube video ID */ function getMyYoutubeVideoId(video_url){ var l = document.createElement("a"); l.href = video_url; var frameId=''; var hostname=l.hostname; var path= l.pathname; var query=l.search; if(hostname=='youtu.be' || hostname=='www.youtu.be'){ frameId=path.replace('/',''); }else if(path=='/watch'){ var queryArray=query.split('='); frameId=queryArray[1]; }else if(path.substr(0,7)=='/embed/'){ frameId=path.substr(7); } return frameId; }