Search code examples
javascripthtmlvideoattributessteam

How to play video in new (blank) window?


Hi guys,
I'running on wordpress
I made this:
https://i.sstatic.net/gQxkx.png

When I click on ''Click here to play the video clip'' it open a new (blank) window)
in HTML editor I wrote code:

<a href="#" onClick="window.open('','video','top=50, left=50, width=280, height=257, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no,');">Click here to play the video clip</a> 


But, I don't know how to implent this code into this blank space:

<script src='http://hqq.tv/player/hash.php?hash=244206211243244205241239213235211241'></script><script src='http://hqq.tv/player/script.php?width=720&height=450'>

I want this blank window will be looks like this:

https://i.sstatic.net/NxvvM.png

Have you any solutions?

Thanks for help.. Have a nice day ! :)


Solution

  • In the window.open('', part you missed the first important part: the URL you should render. What you can do is, within your same web project, you can either:

    a) Create a new, dynamic URL where you can pass the Video ID or something that let's you reference a single video and open that dynamic URL.

    or, if you don't have a backend language, then you can...

    b) Modify the content of the about:blank page you just opened by creating the popup, adding the HTML code inside and opening it. You'll still have an about:blank URL but you'll be actually seeing whatever content you put there. To do so, you should...

    // Source: http://www.electrictoolbox.com/write-content-dynamic-javascript-popup/
    
    var w = window.open('', '', 'width=400,height=400');
    w.document.write('HTML content goes here, such as your script from hqq.tv');
    w.document.close();
    

    And modify the script accordingly.

    PS: Be aware that, in order to write a script tag with Javascript, you'll have to split the tag in order to render it. Check this answer to see the problem and solution.