diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 8960a8d7a..03a352e51 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -350,7 +350,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { $fromWeb = new CompositeField( new LiteralField('headerURL', '

' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '

'), - $remoteURL = new TextField('RemoteURL', 'http://'), + $remoteURL = new TextField('RemoteURL', ''), new LiteralField('addURLImage', '') diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index f97733f0f..82c6a73ef 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -1139,7 +1139,6 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; var val = this.val(), orig = val; val = $.trim(val); - val = val.replace(/^https?:\/\//i, ''); if (orig !== val) this.val(val); this.getAddButton().button(!!val ? 'enable' : 'disable'); @@ -1160,7 +1159,13 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; if (urlField.validate()) { container.addClass('loading'); - form.showFileView('http://' + urlField.val()).done(function() { + + // add "http://" if a protocol is missing from the url + if (val.match(/^https?:\/\//i) == void 0) { + val = 'http://' + val; + } + + form.showFileView(val).done(function() { container.removeClass('loading'); }); form.redraw();