as you know that when you Embed youtube video in your web page, it works fine , but if you click on any part of screen, youtube website will open in new window.
is there
You can leverage the Youtube API with this script which will also allow you to specify specific timecode and display only a portion of the video.
var n = "youtube";
var y = document.createElement('script');
y.type = "text/javascript";
y.src = "//www.youtube.com/iframe_api";
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(y, s);
var player;
var p = document.getElementById(n);
var st = p.getAttribute("startTime");
var et = p.getAttribute("endTime");
var vi = p.getAttribute("videoID");
var ph = p.getAttribute("height");
var pw = p.getAttribute("width");
function onYouTubeIframeAPIReady() {
player = new YT.Player(n, {
height: ph,width: pw,playerVars: {
'rel': 0,
'showinfo': 0,
'hidecontrols': 1
},
events: {
'onReady': lv
}
})
}
function lv(e) {
e.target.cueVideoById({
videoId: vi,startSeconds: st,endSeconds: et
})
}