Forum Moderators: open
Did you notice that your window that says [object] also has javascript:window.open("blah.html") in it?
So, what happened was, when you clicked your link, the webpage actually *became* just "javascript:window.open("blah.html");" (try mozilla to see this. I believe IE does something different).
And, that line still got executed, and the new window, blah.html, opened as well.
Right? Hehe Im not totally clear on all of this.
So, instead, I made a one-line fuction called doit() with just
window.open("blah.html"); in it
and the href looks like:
<a href = "javascript:doit()">Click y0</a>
And it worked great!
Spider-friendly, 'cuz the href attribute is there and gets used. No change to the current window because if the onclick handler returns false, the browser isn't supposed to follow the link.
<added>Also degrades well, since if js is disabled, the browser still has a link to follow, and will.</added>
[edited by: dingman at 3:24 pm (utc) on Oct. 3, 2002]
Can I see the function?
function doit(){
window.open('view.php');
}
Now, here is another way: (I am not very sure about the whole "spider-friendly" thing, because I dont even know what that is ;))
<a href = "javascript:windowHandle = window.open('view.php','windowname','width=500,height=500,location=yes'); windowHandle.focus();">Click y0</a>
the windowHandle.focus is quite necessary...
If the former, my guess would be that instead of
<a href="http://www.mysite.com/other.html" onclick="window.open(this.href);return false;">another page (new window)</a>
you could do
<a href="doesn't matter as long as onclick returns false" onclick="window.open('other.html');return false;">another page (new window)</a>
If the latter, enlighten me :)
I'm a lot less experienced than you are, and search engine behavior is not something I'm used to thinking about, let alone knowledgable about. September 10th, I didn't even know what "page rank" was. Might want to ask whether googlebot or any of the other search engine spiders have js interpreters. If so, I don't think anything we've looked at will hide from them.