Wednesday, 14 September 2016

Showing uploaded File in Iframe using Javascript


$(document).on("input",".upload", function(){
var src = $(this).val();
src = src.replace("watch?v=", "v/");
src = src.replace("video/", "embed/video/");
var abc="<iframe src='my_source' width='452' height='345' scrolling='no' frameborder='no' target='_top' allowFullScreen></iframe>".replace(/my_source/g,src);
if (src.match(/(youtube|youtu|vimeo|veoh|dailymotion|kickstarter|metacafe)\.(com|be)\/((watch\?v=([-\w]+))|(video\/([-\w]+))|(projects\/([-\w]+)\/([-\w]+))|([-\w]+))/)) {
$(this).next('#thumbs').empty().append(abc);
}
else if( src.match(/^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp4|.MP4|.avi|.AVI|.3gp|.3GP)$/)) {
$(this).next('#thumbs').empty().append(abc);
}
else{$(this).next('#thumbs').empty();}
});
view raw show.js hosted with ❤ by GitHub

No comments:

Salesforce CRM vs. Zoho: A Comparative Analysis

Introduction: Selecting the right customer relationship management (CRM) software is crucial for businesses seeking to streamline their sal...