Posted by jordipujol on January 24, 2007 at 5:53pm
Jump to:
| Project: | Pdfview |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
for the average user, is more friendly open the pdf in a new navigator window. I include the code that does so.
added target=_blank,
******* code ****************************
/**
* Theme a Pdfview link
* @ingroup themeable
*/
function theme_pdfview_link($node) {
if ((user_access('access content as PDF') || user_access('administer nodes'))
&& variable_get('pdfview_'.$node->type, 1) == 1) {
$attributes = array("title" => t('Display a PDF version of this
page.'),"target" => t('_blank'));
$links = l(t('download PDF'), "node/$node->nid/pdf", $attributes);
}
return $links;
}
******* code end l****************************
Comments
#1
It's up to the user to set up his browser to do that
#2
What do you mean it's up to the user to set his browser to do it? It's fairly customary when moving away from an HTML page to something else to open it in another window or tab, just as the code above suggests. This is a good addition and works.
#3
While yes, you can use a setting to open windows in a new tab / window in the preferences in most browsers, what is being talked about here is instead of navigating away from the page where the .pdf document is referenced, it will automagically open a new tab in which the .pdf document is displayed, thereby keeping the original page up for the user to see.
#4
Where do I have to put this code ?
Thanks