I’m trying to create a link on our website that goes to a training video on youtube and want it to open in a window with a specific size and location on the page. We also want to inform the viewer that they will be leaving our site to view the video.
Everything is working as planned except if “Cancel” is clicked on the pop up message stating they are going to leave our site the movie still opens. I took the window.open out of the popup message code otherwise the video opened in two windows. One with the correct size and location.
Here is the code going to the link with the onclick function.
<a href=”
Popup Message Code
<script>
function leaveCheck2(url) {
if(confirm(“We hope you enjoy our video. However you are being redirected to [url]www.youtube.com
}
</script>
Window Size & Location Code
<script>
// JavaScript popup window function
function basicPopup(url) {
popupWindow = window.open(url,’popUpWindow’,’height=375,width=640,left=300,top=300,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no, status=yes’)
}
</script>