Skip to content

Commit f07c86b

Browse files
优化editor页面错误输入地址后跳转404页面效果 review by luox
1 parent c7fec52 commit f07c86b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

examples/js/editor.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,20 @@ function loadExampleHtml() {
9595
if (!mapUrl) {
9696
return;
9797
}
98+
var isError = false;
9899
var html = $.ajax({
99100
url: mapUrl,
100101
async: false,
101102
error: function (error) {
102103
alert(resources.editor.envTips);
103-
html = "";
104+
isError = true;
104105
}
105106
}).responseText;
106-
if (html && html != "") {
107+
if (html && html != "" && !isError) {
107108
$('#editor').val(html);
108109
loadPreview(html);
110+
} else {
111+
window.location.href = window.location.origin + '/web/404.html';
109112
}
110113
}
111114

examples/maplibregl/dataFlowService.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
map.addControl(new maplibregl.NavigationControl(), 'top-left');
6464

6565
maplibregl.supermap.SecurityManager.registerToken(urlDataFlow, window.exampleToken);
66-
var popup = new maplibregl.Popup();
66+
var popup = new maplibregl.Popup({
67+
focusAfterOpen: false
68+
});
6769

6870
map.on('load', function () {
6971
var options = {

0 commit comments

Comments
 (0)