元http-equiv,可以吗?
我已将此代码放入索引中,以加载新页面,然后 2 秒后,移至原始屏幕。
打算加载“music_player”,然后 2 秒后,移至我的 NORMAL 页面。
让播放器在新窗口中加载。但代码无法正常工作,它只是在没有“Target=”_blank”的情况下进行替换,无法弄清楚为什么?
下面是代码!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="5; url=http://www.mysite.com/start.php" />
<meta http-equiv="refresh" content="3;URL=http://www.mysite.com/player.html" Target="_blank/>
</head>
I have put this code in my index, to load a new page, and then later 2 secs later, move to my original screen.
With the intention to load a "music_player" and then 2 seconds later, move toward my NORMAL page.
Having the player load in a new window. But the code don't work as it should, it just replaces without the "Target="_blank" can't figure out why?
below is code !!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="5; url=http://www.mysite.com/start.php" />
<meta http-equiv="refresh" content="3;URL=http://www.mysite.com/player.html" Target="_blank/>
</head>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据w3schools,target不是meta标签的属性。如果你想要这样的东西,你应该使用 javascript。
According to w3schools, target is not an attribute of the meta tag. If you want something like this, you should use javascript.
元刷新方法重定向当前页面 - 它不能用于打开新窗口。为此,您需要 javascript
window.open
http:// www.w3schools.com/jsref/met_win_open.asp
和
setTimeout
将其延迟 2 秒:http://www.w3schools.com/js/js_timing.asp
The meta refresh method redirects the current page - it cannot be used to open new windows. For that, you'll need javascript
window.open
http://www.w3schools.com/jsref/met_win_open.asp
And
setTimeout
to delay it by 2 seconds:http://www.w3schools.com/js/js_timing.asp
标签没有 target 属性,因此您不能使用它来触发新的浏览器窗口。
The
<meta>
tag does not have a target attribute, so you can't use it to trigger a new browser window.如果它不起作用,则可能是因为
meta
标记不接受目标属性。您可以尝试使用 javascript 执行此操作:If it's not working then it's probably because the
meta
tag doesn't accept the target attribute. You could try doing this with javascript:看起来有两个问题。首先,第二个
http-equiv="refresh"
将不起作用,因为页面已经第一次刷新。如果您想再次刷新,则必须将第二个http-equiv="refresh"
放在第二页中。第二个问题,http-equiv="refresh"
并不意味着打开新窗口。为此,您必须使用 Javascript (window.onload),但要小心——您会遇到弹出窗口阻止程序问题。基本上你会想要:
It looks like there are two problems. First, the second
http-equiv="refresh"
will have no effect, because the page will already have refreshed the first time. If you wanted to refresh again, you'd have to put the secondhttp-equiv="refresh"
in the second page. Second problem,http-equiv="refresh"
isn't meant to open new windows. You'll have to use Javascript (window.onload) for that, but be careful -- you'll run into popup blocker problems.Basically you'll want: