PDA

View Full Version : Javascript "open browser window"


urbanrays
12-31-2008, 02:59 PM
Hi

I will try and make this understandable,

I have tested my site and the problem i am having is that six of my pages on my site are using javascript, open browser window, with the tests i have done it does not recognise these pages, is there anyway of opening a new html page that is sized to the specific size i need without using javascript or is there any other way to do this so the search engines recognise javascript links.

Thanks for any help

Corrosive
12-31-2008, 03:32 PM
Hi

I will try and make this understandable,

I have tested my site and the problem i am having is that six of my pages on my site are using javascript, open browser window, with the tests i have done it does not recognise these pages, is there anyway of opening a new html page that is sized to the specific size i need without using javascript or is there any other way to do this so the search engines recognise javascript links.

Thanks for any help

OK, not sure what you mean by 'it does not recognise these pages'. Can you be a bit more specific or provide a URL for a page. Thanks

urbanrays
12-31-2008, 03:57 PM
Hi sorry my site isnt live I upload just to test and took back off again but when i say tested the website i used

http://www.ranks.nl/tools/spider.html

to see how it would fair, this is where it showed all my navigation links but failed to find the javascript links, and I feel these pages are quite important but they need to be a specific size hope this helps

Corrosive
12-31-2008, 04:07 PM
Hi sorry my site isnt live I upload just to test and took back off again but when i say tested the website i used

http://www.ranks.nl/tools/spider.html

to see how it would fair, this is where it showed all my navigation links but failed to find the javascript links, and I feel these pages are quite important but they need to be a specific size hope this helps

So you are thinking that your site structure is not 'Search Engine Friendly' because it has pages that open via javascript links rather than html?

urbanrays
12-31-2008, 04:11 PM
yes sorry (noob talking) is their anything i can do to get round this

Corrosive
12-31-2008, 04:22 PM
yes sorry (noob talking) is their anything i can do to get round this

Yes, but it's quite difficult to explain in a forum post.

Can you post the code for one of the links you think is an issue?

urbanrays
12-31-2008, 04:38 PM
here you go

<td><div align="center"><a href="javascript:;" class="urbanlarge" onClick="MM_openBrWindow('sunbedadvice.htm','sunbedadvice', 'scrollbars=yes,width=634')">SUNBED GUIDE </a></div></td>

Corrosive
12-31-2008, 05:00 PM
here you go

<td><div align="center"><a href="javascript:;" class="urbanlarge" onClick="MM_openBrWindow('sunbedadvice.htm','sunbedadvice', 'scrollbars=yes,width=634')">SUNBED GUIDE </a></div></td>

OK, the method I use to open a new browser window. is this javascript in the head tags...

<script language="JavaScript" type="text/JavaScript">
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
</script>


and then create your links with rel="external" in them. I.e.

<a rel="external" href="yourpage.htm"</a>

This is the correct way to open a new browser window as you are still using a proper link but just relating the action back to the javascript in your head tags...which opens the new window.

Make sense?

The way you are using is out-of-date. I don't know though how you specify the browser window this way.

The second method you could try is to open the pages using something like 'thickbox'. Visit http://www.yotocreative.co.uk/contact.htm and click on 'customer reviews'.

This way you can specify the size of the view screen and it is still a valid link.

Hope this helps.

urbanrays
12-31-2008, 05:29 PM
That is brill thanks so much, the reason it maybe outdated is that i am using MX dinosaur 2004, I know, I know, I know dont say a word, like the look of the thickbox is this possible with mx dinosaur 2004

Corrosive
12-31-2008, 05:37 PM
i am using MX dinosaur 2004

So am I mate. :wink:

I just don't rely on the code it produces and tend to get javascript from elsewhere and plug it into my pages. I really just use DW for the code 'hints' and checking what I am doing occasionally in design view.

Glad I could help anyway. Let me know if you get stuck.

urbanrays
12-31-2008, 05:57 PM
hi sorry to be a pain but just check this out because i have just checked the site again doing what you said and it still does not work and i dont know if i have the script in the head correct

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
</script>

Thanks again

urbanrays
12-31-2008, 05:58 PM
or should i just delete the first part of the javascript

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->

K.Simmonds
12-31-2008, 06:00 PM
I found an excellent little free program that sounds as though its just what you need. The link for the download and the explanation, is:
http://www.fourlevel.com/dreamweaver/extensions/openbrowser/index.htm

Corrosive
12-31-2008, 06:06 PM
or should i just delete the first part of the javascript

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->

Yeah, take the first bit out unless you specifically need it for something. It's really hard to debug a site you can't see I'm afraid.

urbanrays
12-31-2008, 06:25 PM
can i thank you both for all the help with this issue the fourlevel worked perfectly and the tests are now showing the links Have a happy new year peeps