Merge pull request #3744 from Snuffleupagus/enable-www-links
Enable links beginning with 'www.' even if no protocol is specified
This commit is contained in:
commit
f72fad9a1a
@ -616,7 +616,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
|||||||
if (action) {
|
if (action) {
|
||||||
var linkType = action.get('S').name;
|
var linkType = action.get('S').name;
|
||||||
if (linkType === 'URI') {
|
if (linkType === 'URI') {
|
||||||
var url = action.get('URI');
|
var url = addDefaultProtocolToUrl(action.get('URI'));
|
||||||
// TODO: pdf spec mentions urls can be relative to a Base
|
// TODO: pdf spec mentions urls can be relative to a Base
|
||||||
// entry in the dictionary.
|
// entry in the dictionary.
|
||||||
if (!isValidUrl(url, false)) {
|
if (!isValidUrl(url, false)) {
|
||||||
@ -652,6 +652,14 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
|
||||||
|
function addDefaultProtocolToUrl(url) {
|
||||||
|
if (url.indexOf('www.') === 0) {
|
||||||
|
return ('http://' + url);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
Util.inherit(LinkAnnotation, Annotation, {
|
Util.inherit(LinkAnnotation, Annotation, {
|
||||||
hasOperatorList: function LinkAnnotation_hasOperatorList() {
|
hasOperatorList: function LinkAnnotation_hasOperatorList() {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user