You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: htmlpreview.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,9 @@
22
22
for(i=0;i<a.length;++i){
23
23
href=a[i].href;//Get absolute URL
24
24
if(href.indexOf('#')>0){//Check if it's an anchor
25
-
a[i].href='//'+location.hostname+location.pathname+location.search+'#'+a[i].hash.substring(1);//Then rewrite URL with support for empty anchor
25
+
if((a[i].protocol+"//"+a[i].hostname+a[i].pathname)==url){//Rewrite links to this document only
26
+
a[i].href='//'+location.hostname+location.pathname+location.search+'#'+a[i].hash.substring(1);//Then rewrite URL with support for empty anchor
27
+
}// Do not modify external URLs with fragment
26
28
}elseif((href.indexOf('//raw.githubusercontent.com')>0||href.indexOf('//bitbucket.org')>0)&&(href.indexOf('.html')>0||href.indexOf('.htm')>0)){//Check if it's from raw.github.com or bitbucket.org and to HTML files
27
29
a[i].href='//'+location.hostname+location.pathname+'?'+href;//Then rewrite URL so it can be loaded using CORS proxy
0 commit comments