I am interested in opening a video in a new window/tab using the tag, as I'm having intermittent issues with IE not being able to open linked .mp4 files. I have tried to cobble something in javascript together from other answers with my very flawed understanding, but I just can't make it work. Basically, I have videos, I want to be able to use this same code to reference them separately each time with a different link/button/picture and open them in a new window.
Here's my Attempt 1:
<script>
function nWin () {
var win = window.open("", "Title", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=780, height=200, top="+(screen.height-400)+", left="+(screen.width-840));
win.document.body.innerHTML = "<html><body><video width="90% height="90%" controls><source src='myvideo.mp4' type="video/mp4">Your browser does not support the video tag.</video></body></html>";
}
</script>
<a href="#" onClick="nWin()">Open</a>
Here's my Attempt 2:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('#popup').click(function(e) {
e.preventDefault();
var w = window.open('about:blank', 'MyWindow', 'width=400,height=400');
w.document.write('<html><body><video width="90% height="90%" controls><source src='myvideo.mp4' type="video/mp4">Your browser does not support the video tag.</video></body></html>');
w.document.close();
})
});
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<body>
<a id="popup" href="">Open me</a>
</body>
</html>
Maybe it is not possible to do this? Maybe I am missing something fundamental about functions. I thank you very sincerely in advance for your help.