diff --git a/ports/javascript/lvgl_editor.html b/ports/javascript/lvgl_editor.html
index 1124a0d3a..2ec6dac81 100644
--- a/ports/javascript/lvgl_editor.html
+++ b/ports/javascript/lvgl_editor.html
@@ -149,8 +149,7 @@
function get_iframe_url() {
/* Assemble the URL */
var newPathname = window.location.href.substr(0, window.location.href.lastIndexOf('/'));
- newPathname += "/lvgl.html?env=dev";
- newPathname = window.location.protocol + "//" + window.location.host + newPathname;
+ newPathname += "/lvgl.html" + (window.location.href.indexOf('?') ? ':' : '?') + "env=dev";
console.log(newPathname);
return newPathname;
}