diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index eab86d75b..6be92c9fb 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -233,9 +233,10 @@ var padeditbar = (function() }, setEmbedLinks: function() { + var padPath = window.parent ? window.parent.location.href : document.location.href; if ($('#readonlyinput').is(':checked')) { - var basePath = top.location.href.substring(0, top.location.href.indexOf("/p/")); + var basePath = padPath.substring(0, padPath.indexOf("/p/")); var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId; $('#embedinput').val("