元http-equiv,可以吗?

发布于 2024-08-17 22:03:06 字数 509 浏览 4 评论 0原文

我已将此代码放入索引中,以加载新页面,然后 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

毁我热情 2024-08-24 22:03:06

根据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.

浅笑依然 2024-08-24 22:03:06

元刷新方法重定向当前页面 - 它不能用于打开新窗口。为此,您需要 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

随风而去 2024-08-24 22:03:06

The <meta> tag does not have a target attribute, so you can't use it to trigger a new browser window.

青瓷清茶倾城歌 2024-08-24 22:03:06

如果它不起作用,则可能是因为 meta 标记不接受目标属性。您可以尝试使用 javascript 执行此操作:

<body onload="window.open(...);">

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:

<body onload="window.open(...);">
凉风有信 2024-08-24 22:03:06

看起来有两个问题。首先,第二个 http-equiv="refresh" 将不起作用,因为页面已经第一次刷新。如果您想再次刷新,则必须将第二个 http-equiv="refresh" 放在第二页中。第二个问题,http-equiv="refresh" 并不意味着打开新窗口。为此,您必须使用 Javascript (window.onload),但要小心——您会遇到弹出窗口阻止程序问题。

基本上你会想要:

  1. 加载第一页,打开弹出播放器窗口。
  2. 之后,您转发到 start.php(或者您可以将您的第一页与 start.php 合并,打开播放器窗口,然后停留在当前位置)。

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 second http-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:

  1. First page loads, opens popup player window.
  2. After, you forward to start.php (or you could just merge your first page with start.php, open the player window, and stay where you are at).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文