New window?

Started by Col, January 29, 2006, 03:26:22 PM

Previous topic - Next topic

Col

Hi,

I know how to use target=new, but how do I create a window without the browser header in it?

Thanks.

Saleh

you mean without the tool bars?
you'd need javascript here:
<a href="javascript:void(0);" onclick="window.open('http://www.domain.com','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no');">Open Window</a>

We don't need a reason to help people

Tim

Actually that would not allow people with javascript disabled, text browsers and more importantly for most: search engines to access that page

Use this instead
<a href="http://www.domain.com" onclick="window.open('http://www.domain.com','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no'); return false;">Open Window</a>

Col

Thanks for that Tim. And thanks too Saleh. I may have a use for JS too anyway.

Tim, I should mention, the code boxes do not work with IE. They consist of just the scroll bar. I had to retrieve the code by using the quote botton. I have tried FF since, and it does, however, render correctly with that.

Saleh

#4
QuoteActually that would not allow people with javascript disabled, text browsers and more importantly for most: search engines to access that page
good point, Tim :)
but I've never cared for those who disabled Javascript! :P I mean why would they do that? but I am sure it will only hurt the website not the visitor :-\

We don't need a reason to help people

Tim

Quote from: Saleh on February 06, 2006, 06:50:43 AM
but I've never cared for those who disabled Javascript! :P I mean why would they do that?
Stop all pop ups, stop all risks of giving away your passwords, stop all annoying animations, etc etc etc.

The change I suggested is small but will have such a large impact on the ability of search engines to spider a page. Now they can, with the other, they couldn't...

SingingCrane

#6
I am trying to use this method but with no success....here's what I have for code:

// Show the [audio] button.
echo ($current_action == 'audio' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'audio' ? 'active_back' : 'back' , '">
<a href="http://www.flipside.singingcrane.com/player.html" onclick="window.open('http://www.flipside.singingcrane.com/player.html','','scrollbars=no,menubar=no,height=315,width=300,resizable=no,toolbar=no,location=no'); return false;">Audio</a>
</td>' , $current_action == 'audio' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


The code is basically one of the other links in the theme's index.template.php (default theme) file copied and renamed to accommodate a link titled 'Audio'. For some reason I keep getting a template parse error, but all the code matches (as far as I can see). Help? Thanks.

sm2k

Quote from: Tim on February 05, 2006, 07:43:34 AM
Actually that would not allow people with javascript disabled, text browsers and more importantly for most: search engines to access that page

Use this instead
<a href="http://www.domain.com" onclick="window.open('http://www.domain.com','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no'); return false;">Open Window</a>

Problem: when you click the link, the *same* content will appear both the new window and the original window.  This is not what you'd want in most cases, so the first method posted above will be best for the end user.

If you want the search engines to be able to spider the content you only want to open in popups, then maybe include the popup content in your sitemap.  Most users don't browse via sitemap, and it's probably not *critical* that you take control of their browser window size if they do happen to.

SingingCrane

Well I found the problem with a little help from a coworker who knows PHP well. The javascript has quotes ( ' ) that the PHP tries to parse, and gives the parse error. The way it was fixed was to put a backslash in front of each quote in the javascript so that the template parses correctly. Here is the code I use in my forum:
// Show the [radio] button.
echo ($current_action == 'radio' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'radio' ? 'active_back' : 'back' , '">
<a href="#" onclick="window.open(\'http://www.flipside.singingcrane.com/player.html\',\'requested_popup\',\'scrollbars=no,menubar=no,height=315,width=300,resizable=no,toolbar=no,location=no\');">Radio</a>
</td>' , $current_action == 'radio' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


notice the part that says:
<a href="#" onclick="window.open(\'http://www.flipside.singingcrane.com/player.html\',\'requested_popup\',\'scrollbars=no,menubar=no,height=315,width=300,resizable=no,toolbar=no,location=no\');">Radio</a>
where all of the quotes have backslashes in front of them.

This is what works for me! ;D

Tim

Quote from: sm2k on February 14, 2006, 02:20:34 PM
Problem: when you click the link, the *same* content will appear both the new window and the original window.  This is not what you'd want in most cases, so the first method posted above will be best for the end user.
No, because return false stops the link.

sm2k

Correct you are.  Sorry about that!

Advertisement: