Modify page with JS to create link

0

I need to modify a page so that it offers a link to a video in an external play ...

My current script:

(function() {
    'use strict';

   var tag = document.querySelector("video source").src;
   //location.href=tag;
   //window.locationf=tag;
   document.getElementById("wrapper").innerHTML = "<a href='' id='link'>Assita o EP via Player Externo</a>";
   document.querySelector("script").src = "a";
})();

This is the page that I want to change: link

  • The script needs to get the src link from TAG "video" ...

    // var tag = document.querySelector ("video source"). src;

  • The script must remove the page ...

    // document.getElementById ("wrapper"). innerHTML="Assume the EP via External Player";

  • The script must use the value of the TAG variable in the HREF field of the link with ID = LINK ...

    // I do not know how to modify ...

asked by anonymous 08.11.2017 / 14:42

1 answer

1

Since you already have url , you should only put it within href of tag a :

var a = "<a href='" + tag + "' id='link'>Assita o EP via Player Externo</a>";
document.getElementById("wrapper").innerHTML = a;
    
08.11.2017 / 14:53