Forum Moderators: phranque

Message Too Old, No Replies

Meta refresh or Javascript window.location for this task?

Trying to mimic target=_blank...

         

HughMungus

11:46 pm on Feb 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let's say you wanted to mimic the behavior of opening a link in a new browser window without using target="_blank"...if you really need to know why I could tell you but that's not so important.

What I thought I could do is have the link be to a page that spawns a popup then returns the browser to the original page (the page from which the link was cilcked; the result is two pages open, just like with target=_blank).

So I have two options for making the original page: meta refresh or javascript window.location. They both seem to work equally well, but, I'm wondering if there are some caveats to using one or the other. Also, any caveats on even doing this at all (going from one page to another then back)?

encyclo

12:53 am on Feb 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Definitely not meta refresh - you're just asking for indexation problems. If you must, then Javascript is the way to go.

But the real question remains: why on earth would you not want to use

target="_blank"
? I know you say it's not so important, but I can't see the point of reinventing the wheel (but badly).

HughMungus

1:06 am on Feb 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm running an audio blogging service for blog users. When they leave a message over the phone, my service posts to their blog using their username/password. Right now, the links are direct links to the audio files but I want to change the links to link to a small php/html page with an embedded player. The problem is that I can't get rid of the toolbars and address bars with javascript if I use target=_blank. I think I can only do that if that information is in a link TO a new window, not in the code of the new window itself.

Now if someone knows how to get rid of toolbars, etc., in a new window using target=_blank without javascript in the link, I'd love to hear it. However, I just read today on here that it's not possible.

By the way, what's wrong with meta-refresh and the page being indexed? Is that a filter thing because of cloakers? I think I read about that.

encyclo

1:29 am on Feb 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ahh, now I understand! Definitely a Javascript job. You can use
window.open
to open the window with the required dimensions and scrollbars removed, etc., embed the player within that open window, and use
return false;
to disactivate the live link to the audio file which can remain for those with Javascript disabled.

<a href="audio.mp3" onclick="yourFunction('audio.mp3,whatever');return false;">

Meta refresh is handled badly by search engines at the moment, and it won't really be appropriate in this situation anyway (you can't use it to resize windows).

HughMungus

1:51 am on Feb 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, but, wouldn't that require defining the function on their page?

What about just doing something like this:

<a href="javascript: window.open('http://www.widgets.com/play.php?mbxno=1087&msgno=0502011008', 'player', 'toolbar=no,width=320,height=240'); void('');">Test link</a>