通过window.open发送给另一个网页
在主页面中的标签中添加函数,及要发送的消息
<a class="video-post" onclick="PlayVideo(this)" id="aid=57472019&bvid=BV17x411X77w&cid=100203546&page=1">
在该网页的javascript里写上
function PlayVideo(obj){
var ID = obj.getAttribute("id");
window.open("single-video.html?"+ ID );
}
这里js会打开single-video.html,在该网页链接后面加上?和ID,ID就是主页面里id里的参数
在single-video里面的js里接收参数
console.log('this is body js');
window.onload=function(){
var afterUrl = location.search; //接受?后面的参数,包括?
var GitID = "https://player.bilibili.com/player.html"+afterUrl+"&as_wide=0&high_quality=1&danmaku=0";
var shopping = document.getElementById("playsrc").src=GitID;
};
这里我实现是在播放页面里播放指定的B站视频