www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help…Almost Got It

  1. #1
    Join Date
    Mar 2013
    Posts
    13

    Help…Almost Got It

    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=" http://www.youtube.com/watch?v=t5KibZuz6Kk" onclick="leaveCheck2(this.href); basicPopup(this.href); return false; ">

    Popup Message Code

    <script>
    function leaveCheck2(url) {
    if(confirm("We hope you enjoy our video. However you are being redirected to www.youtube.com and Apple River State Bank is not responsible for services beyond this point."))(url)
    }
    </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,tool bar=no,menubar=no,location=no,directories=no, status=yes')
    }
    </script>

  2. #2
    Join Date
    Mar 2011
    Posts
    1,144
    Why not avoid the issue (and save the user an unnecessary click) by embedding the YouTube video in a page on the parent website and display that in the pop-up window? Simply hosting the video on the parent site might even be better unless you have bandwidth issues.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Jul 2013
    Posts
    66
    Methods like alert and confirm are widely considered "out of date" and should be avoided in favor of proper DOM methods to display these information (a simple, small lable shoulf suffice). Popups are frowned upon, too. Embedding the video should be just about the best way to do this these days. There shouldn't be any bandwidth issues as the video content will not be downloaded until the video is started (actually, then they won't be leaving your site anymore).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles