@@ -42,7 +42,8 @@ export default (client, layerConf, config) => {
42
42
43
43
const htmlZoom = document . getElementById ( 'subscribed-zoom' )
44
44
const htmlGfi = document . getElementById ( 'subscribed-gfi' )
45
- const htmlExport = document . getElementById ( 'subscribed-export' )
45
+ const htmlExportA = document . getElementById ( 'subscribed-export-a' )
46
+ const htmlExportImg = document . getElementById ( 'subscribed-export-img' )
46
47
47
48
mapInstance . subscribe (
48
49
'plugin/zoom/zoomLevel' ,
@@ -52,9 +53,17 @@ export default (client, layerConf, config) => {
52
53
'plugin/gfi/featureInformation' ,
53
54
( v ) => ( htmlGfi . innerHTML = JSON . stringify ( v , null , 2 ) )
54
55
)
55
- mapInstance . subscribe ( 'plugin/export/exportedMap' , ( screenshot ) =>
56
- htmlExport . setAttribute ( 'src' , screenshot )
57
- )
56
+ mapInstance . subscribe ( 'plugin/export/exportedMap' , ( screenshot ) => {
57
+ htmlExportImg . setAttribute ( 'src' , screenshot )
58
+ if ( navigator . userAgent . toLowerCase ( ) . includes ( 'firefox' ) ) {
59
+ htmlExportImg . onclick = function ( ) {
60
+ window . open ( this . src , '_blank' )
61
+ }
62
+ htmlExportA . onclick = ( ) => false
63
+ } else {
64
+ htmlExportA . setAttribute ( 'href' , screenshot )
65
+ }
66
+ } )
58
67
59
68
window . mapInstance = mapInstance
60
69
} )
0 commit comments