diff --git a/static/js/theme.js b/static/js/theme.js index 97f7d6b720..3b934fd40c 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -305,7 +305,7 @@ function initSwagger( update, attrs ){ function initAnchorClipboard(){ document.querySelectorAll( 'h1~h2,h1~h3,h1~h4,h1~h5,h1~h6').forEach( function( element ){ - var url = encodeURI(document.location.origin + document.location.pathname); + var url = encodeURI( (document.location.origin == "null" ? (document.location.protocol + "//" + document.location.host) : document.location.origin )+ document.location.pathname); var link = url + "#" + element.id; var new_element = document.createElement( 'span' ); new_element.classList.add( 'anchor' );