Meta http-equiv, can I?
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="refr开发者_JS百科esh" 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>
According to w3schools, target is not an attribute of the meta tag. If you want something like this, you should use javascript.
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
The <meta>
tag does not have a target attribute, so you can't use it to trigger a new browser window.
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(...);">
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:
- First page loads, opens popup player window.
- 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).
精彩评论