我正在制作一个学校游戏解锁网站,并正在使用关于:空白斗篷.我需要在About:空白网站上添加一个标题,这样老师就不会看到我在上什么.

这是重定向的代码.

<html>

<head>


<body onclick="MyWindow1()">Click here to start</body>



</head>

<script>

(url);

var newWin = window.open
function MyWindow1(){

var win = window.open()
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = "./Main.html";
win.document.body.appendChild(iframe)
location.replace("https://www.google.com/")
}



</script>

</html>

这是main.html代码的样子.这是关于:空白网站.

<html>

<head>


<body onclick="MyWindow1()">Click here to start</body>



</head>

<script>

(url);

var newWin = window.open
function MyWindow1(){

var win = window.open()
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = "./Main.html";
win.document.body.appendChild(iframe)
location.replace("https://www.google.com/")
}



</script>

</html>

如果我只运行第二个文件,它不会执行关于:空白的操作,但会显示标题.谢谢!

推荐答案

您可以使用win.document.title = "Your Title Here";设置新窗口的标题

示例:

<script>
    (url);
    var newWin = window.open
    function MyWindow1() {
        var win = window.open()
        win.document.title = "Your Title Here";
        var iframe = win.document.createElement('iframe')
        iframe.style.width = "100%";
        iframe.style.height = "100%";
        iframe.style.border = "none";
        iframe.src = "./Main.html";
        win.document.body.appendChild(iframe);
        location.replace("https://www.google.com/");
    }
</script>

Html相关问答推荐

你能让Cypress测试为p—fileUpload做文件上传吗?

我需要主页按钮出现在中间

创建具有圆锥渐变的水平CSS聚光灯

使用HTML进行DAX测量

Angular -表和源映射中未显示的数据错误

IFRAME中的Chrome图像未调整大小

CSS中的转换属性是如何工作的?

如何使背景图像在面包屑中相互重叠

如何防止滑动滚动元素时touch 屏出现空白区域?

CSS 伪类 Select 器未按预期工作

如何在r中提取明显非标准html标签的值

网格布局中的组件

为什么我的 html 对话框在 React 中没有渲染在我的内容之上?

如何调整网格中单元格的高度?

两个span,一个在div居中,好像没有另一个,另一个在右边

按钮显示:内联不换行

使用 Selenium for Python 在网站上查找类名称中包含换行符的元素

我可以将两个元素之间的所有空间都放在弹性框或网格中吗?

是否有一种静态方式可以根据暗模式 Select 一张或另一张图像?

如何将图像高度设置为等于文本高度?