CarlosSimoes / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

Opera failed to load kmz file #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. opera 12.00
2. windows 7
3. http://bliksemdetectie.nl/GLv30/

What is the expected output? What do you see instead?
To see a kmz layer on g-maps, works in chrome-firefox-IE9.0

What version of the product are you using? On what operating system?
ZipFile.complete.js 79.0 KB r77 Mar 4, 2012 geocodezip
geoxml3.js  69.3 KB r78 Mar 4, 2012 geocodezip
windows 7

Please provide any additional information below.
Also the same problem on this site: 
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linkto.html

Original issue reported on code.google.com by g.m.hell...@gmail.com on 29 Jun 2012 at 2:52

GoogleCodeExporter commented 9 years ago
Don't think this is the problem (I don't have access to Opera at the moment) 
but the google maps API v3 does not officially support Opera:

https://developers.google.com/maps/faq#browsersupport

=======================================================
Which web browsers does the Google Maps JS API support? 
The Google Maps JavaScript API supports the following web browsers: 

Google Maps JavaScript API V3:

IE 7.0+ (Windows) *
Firefox 3.0+ (Windows, Mac OS X, Linux)
Safari 4+ (Mac OS X, iOS)
Chrome (Windows, Mac OS X, Linux)
Android
BlackBerry 6
Dolfin 2.0+ (Samsung Bada)
* Internet Explorer's Compatibility View is not supported.
=======================================================

Original comment by geocodezip on 29 Jun 2012 at 4:25

GoogleCodeExporter commented 9 years ago
Looks like ZipFile.complete.js has a problem in Opera:

sig: 4915280 (0x4B0050)
ZipFile.Signatures.Entry: 67324752 (0x4034B50)

Results in "WARNING: this file does not appear to be a zip file"

Original comment by geocodezip on 30 Jun 2012 at 3:43

GoogleCodeExporter commented 9 years ago
oeh nice, hopefully they can fix it
I am a bit of a newbie to the js area, stil learning.

Original comment by g.m.hell...@gmail.com on 30 Jun 2012 at 4:06

GoogleCodeExporter commented 9 years ago
This "patch" works in Opera:

/* patch for Opera */
  if (/opera/i.test(navigator.userAgent)) {
fixedArray = new Uint8Array(binStream.length/2);
    for (var i=0; i<binStream.length; i+=2) {
        fixedArray[i/2]=binStream.array[i];
    }
binStream.array = fixedArray;
    binStream.length = binStream.length/2;
}
/* end patch for Opera */

Test version of ZipFile.complete.js containing the patch is here for now:
http://www.geocodezip.com/geoxml3_test/ZipFile.complete.js

Let me know if it works for you.

Still hoping for a more elegant fix (or acknowledgement that this is a bug in 
Opera).

Original comment by geocodezip on 1 Jul 2012 at 9:49

GoogleCodeExporter commented 9 years ago
Patch works for me :)

Thank you for the quick fix

Original comment by g.m.hell...@gmail.com on 2 Jul 2012 at 4:59

GoogleCodeExporter commented 9 years ago
Updated the "patch" to include verification that the problem exists before 
fixing it, just in case the problem gets fixed:

/* patch for Opera */
if (/opera/i.test(navigator.userAgent) && 
    // make sure it is still broken,
    // the first 4 bytes will contain the zip file signature
    // for the geoxml3 use case (so bytes 1 & 3 will not be 0)
    (binStream.array[1] == 0) && (binStream.array[3] == 0))
{    
    fixedArray = new Uint8Array(binStream.length/2);
    for (var i=0; i<binStream.length; i+=2) {
        fixedArray[i/2]=binStream.array[i];
    }
    binStream.array = fixedArray;
    binStream.length = binStream.length/2;
}
/* end patch for Opera */

Original comment by geocodezip on 3 Jul 2012 at 4:42

GoogleCodeExporter commented 9 years ago
This is a bug in Opera 12

http://stackoverflow.com/a/11322464/1210329

Should be fixed in Opera 12.01

Original comment by geocodezip on 4 Jul 2012 at 4:56

GoogleCodeExporter commented 9 years ago
Tsssk, stupid bugs :S

I'am glad that everything is solved :)

thanks, for everything 

Original comment by g.m.hell...@gmail.com on 4 Jul 2012 at 3:16

GoogleCodeExporter commented 9 years ago
Root cause Opera bug, committed patch Revision 81.

Original comment by geocodezip on 4 Jul 2012 at 6:56

GoogleCodeExporter commented 9 years ago
Setting the MIME type to application/octet-stream as suggested here:

http://stackoverflow.com/questions/11284728/how-do-i-access-8-bit-binary-data-fr
om-javascript-in-opera

worked (when put in the right place). Committed that change Revision 83.

Original comment by geocodezip on 5 Jul 2012 at 3:59