Support relative url and anchor url in code

pull/1/head
yflory 5 years ago
parent bba769ef77
commit d58244b4c4

@ -170,6 +170,14 @@ define([
e.preventDefault(); e.preventDefault();
var $a = $t.is('a') ? $t : $t.parents('a').first(); var $a = $t.is('a') ? $t : $t.parents('a').first();
var href = $a.attr('href'); var href = $a.attr('href');
if (/^\/[^\/]/.test(href)) {
var privateData = common.getMetadataMgr().getPrivateData();
href = privateData.origin + href;
} else if (/^#/.test(href)) {
var target = document.getElementById(href.slice(1));
target.scrollIntoView();
return;
}
framework._.sfCommon.openUnsafeURL(href); framework._.sfCommon.openUnsafeURL(href);
} }
}); });

Loading…
Cancel
Save