Merge pull request #5758 from mjlyons/ext-link-new-window

Add option to open external links in new window
This commit is contained in:
Yury Delendik 2015-02-27 10:49:39 -06:00
commit 4c2640dcf0
2 changed files with 12 additions and 0 deletions

View File

@ -217,6 +217,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
var link = document.createElement('a'); var link = document.createElement('a');
link.href = link.title = item.url || ''; link.href = link.title = item.url || '';
if (item.url && PDFJS.openExternalLinksInNewWindow) {
link.target = '_blank';
}
container.appendChild(link); container.appendChild(link);

View File

@ -160,6 +160,15 @@ PDFJS.verbosity = (PDFJS.verbosity === undefined ?
PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ? PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
16777216 : PDFJS.maxCanvasPixels); 16777216 : PDFJS.maxCanvasPixels);
/**
* Opens external links in a new window if enabled. The default behavior opens
* external links in the PDF.js window.
* @var {boolean}
*/
PDFJS.openExternalLinksInNewWindow = (
PDFJS.openExternalLinksInNewWindow === undefined ?
false : PDFJS.openExternalLinksInNewWindow);
/** /**
* Document initialization / loading parameters object. * Document initialization / loading parameters object.
* *