java - How to make a youtube link as embed? -
<% string song = request.getparameter("songname"); string band = request.getparameter("band"); string url = request.getparameter("url"); %> <div align="center"> <br><br> <% out.print(band + " - " + song); %><br><br> <iframe width="560" height="315" src="<%out.print(url);%>" frameborder="0" allowfullscreen></iframe> </div> <% %>
let's url https://www.youtube.com/watch?v=kxyiu_jcytu want make https://www.youtube.com/embed/kxyiu_jcytu can put @ src=""
you can use replace()
method:
<% out.print(url.replace("watch?v=", "embed/")); %>
Comments
Post a Comment