Forum Moderators: open
I have tried something along the lines of
<a href="javascript:void window.open 'http://www.myownsite/archive1.htm','', '');"><font face="verdana,arial,helvetica" size="1">Archive Page 1</font></a>
But this open the link in a new window and I'd like it to be in the same window. Do I have to use something like document.write (of which I know nothing and will have to learn js just to do this)? I would appreciate if anyone can give me the code I'd need. Thanks
function change_location(val)
{window.location.href = val;}
Okay, so how does that help? Well, it save tons of space in your html code cause then your anchor tags would only consist of <a href = "javascript: change_location("www.somelocation.com")>www.somelocation.com</a> AND you could use the same easy code throughout your site. In case you don't know, here's how to link the external js file:
<SCRIPT LANGUAGE="JavaScript" SRC="externaljsfilename.js" type = "text/javascript"></SCRIPT>
I don't know what the "last part" is. It seems that js is very fussy. A wrong comma or brackets and everything gets screwed up. Is it:
<a href="javascript:void; window.location.href = mydomain.com/page.htm><font face="verdana,arial,helvetica" size="1">Archive Page 1</font></a> . That doesn't seem to work.
Maybe I exaggerated when I said I was a js novice. I meant I was a js complete idiot ;-)
>> Or, if you feel more comfortable with it, create an external js file
I'll have to pass on that. If I can't get this right it's unlikely I'll have much joy with that. Also, it appears that I'll have to create one external js for every destination page (if my guess is correct)
My simple solution would be a replacement for your original suggestion of
<a href="javascript:void; window.location.replace('http://www.myownsite/archive1.htm');"><font face="verdana,arial,helvetica" size="1">Archive Page 1</font></a>
...... with one that does not disable the back button
I appreciate your help.
Why do you need JS in the first place?
Because, as stated earlier, I don't want to transfer PR to these new pages, and I don't want these new pages to be indexed by Google. It would be nice if these new pages were all conveniently in one directory, I could use a robots.txt to block them being indexed.
But as it stands now I need to do it via js.
It would be nice if these new pages were all conveniently in one directory, I could use a robots.txt to block them being indexed.
You can still use robots.txt to disallow those pages.
User-agent: *
Disallow: foobar.html
Disallow: widgets.html
Disallow: barbaz.html
Disallow: path/to/some/file.html
I don't want these new pages to be indexed by Google
...instead you want to possibly prohibit users who may surf with JS disabled from accessing your pages?
Use the right tool for the right job ;)
robots.txt is the way to go... especially since googlebot actually obeys it.
With due respect - and I don't mean to argue with you - but I do believe that js is the right tool for this specific job. Thanks for understanding.
<script>
<!--
mylinks=new Array()
mylinks[0]="http://www.google.com"
mylinks[1]="http://www.yahoo.com"
mylinks[2]="http://www.cnn.com"
linksdesc=new Array()
linksdesc[0]="Google"
linksdesc[1]="Yahoo"
linksdesc[2]="CNN"
for (i=0;i<mylinks.length;i++)
document.write('<a href='+mylinks[i]+'>'+linksdesc[i]+'<\/a><br />')
// -->
</script>