Upon testing my site in IE (7&8), I realised that the maps aren't working - the controls appear (though somewhat mangled) and the map area is the right size, but the 'map' part is blank...

IE spits out an 'Unspecified error' for line 599, char 208 of openlayers.js.
Any ideas?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BWPanda’s picture

BWPanda’s picture

Update: Just tested in IE6 - same problem.
Also, my pngfix images work properly on all pages except those with a map. IE mustn't be reading any scripts after the problem one.
Not sure if that helps fix it or not...

BWPanda’s picture

Status: Active » Needs work
FileSize
259 bytes

Here's a hacky patch I made. It works (maps now visible in IE) but I'm sure there are problems with it...
Hopefully a step in the right direction to getting this fixed properly ;)

tmcw’s picture

Status: Needs work » Fixed

Hi BWPanda,

Check out this book page, which talks about the problem you're likely having. I just backported a fix/workaround (the closest we have to a clean fix) in the Openlayers 1.x branch, so try updating to a nightly and see if that helps at all. The workaround you came up with does battle the problem, but makes the Drupal Behaviors framework we use in 2.x and 0.x impossible.

spydmobile’s picture

I did CVS update this am and I still have this probem.
Strange tho becuase when I go and look at openlayers demos on the openlayers site I see them with no problems, also I can go to Alans page here:
http://sandbox.zzolo.org/openlayers-views-example
And it works fine, but there is no google involved in this demo.
This is happening to IE on my site with the latest OL Module.
It is not theme related. Older versions of the module DO NOT have this problem.

Ok, so to be clear, you mention a workaround, but it does not seem to be helping me if it is in the latest dev.
Can we repoen this?

spydmobile’s picture

Category: bug » support

Ok, Complex.

First, this issue: http://drupal.org/node/478238 was part of the problem. I had to disable the fivestar module, to be able to get the map to render. Now it renders, but errors out on adding behaviours to the map.
it stalls out on this line in openlayers/js/openlayers.js line 681: error: Expected Identifier

  OL.Behaviors[OL.mapDefs[map.id].behaviors[b].js_callback](event);

if you cancel the error, it will keep on rendering.

phayes’s picture

Category: support » bug
tmcw’s picture

Category: support » bug
Status: Fixed » Active

Reopening.

phayes’s picture

Alright.

Fullscreen functionality:
- I've done a fix on the fullscreen behavior. http://drupal.org/cvs?commit=280986 . Now works perfectly in chrome, IE8.
- Half-works in IE7. Goes fullscreen, but z-index is buggy. I tried to debug but I give up. *#^$& internet explorer.
- Does not work in ie6, but doesn't break map either. I'm not even going to bother trying to fix this one.

General Map Functionality:
Seems to work fine in all browsers except ie6. ie6 works haphazardly - eg. works fine with WMS, works fine with Virtual Earth, half works with google (gphysical works, gsat, map and hybrid do not).

Do we want to support IE6? My inclination is to say "no, but willing to accept patches" - what are other's opinions?

phayes’s picture

If anyone runs into any specific IE issues please post them here with whatever map config you have set up. I realize that my testing above was less than exhaustive, so any more cases of IE breaking should be reported here. I am leaving this issue open for now.

zzolo’s picture

I would definitely say "no" on supporting IE6. I am so done with supporting IE6 for any projects where I am able to make that decision. It just isn't worth the time anymore. I think if we specifically stop support, then we need to put something on the project page. Patches are always welcome.

Please note that I don't have any consistent way to test IE, so I cannot really help out either way.

phayes’s picture

Priority: Critical » Normal
Status: Active » Needs review

Since maps are working in IE for everything I've been able to test, marking priority as normal, and needs review (ie more testing).

spydmobile’s picture

I have made a simple preset in my module
I then applied this template to my simple custom content type
when I view the node or I edit/create a node

The map fails to render in IE giving an error Invalid Argument line 597: Pointing to code in the openlayers.js from openlayers.org
breaking on the second line

if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);
var style=document.createStyleSheet();
var shapes=['shape','rect','oval','fill','stroke','imagedata','group','textbox'];

module looks like so:

<?php
// $Id$

/**
 * Implementation of hook_openlayers_presets().
 */
function sparcs_mapping_openlayers_presets() {

  $presets = array();

  $ember_map =  array (
    'projection' => '900913',
    'width' => 'auto',
    'default_layer' => 'openlayers_layers_google_physical',
    'height' => '500px',
    'center' => 
    array (
      'lat' => '9854430.827226',
      'lon' => '-13188750.606602',
      'zoom' => '4',
    ),
    'options' => 
    array (
      'displayProjection' => '4326',
      'maxResolution' => '156543.0339',
      'maxExtent' => 
      array (
        'left' => '-20037508.34',
        'right' => '20037508.34',
        'bottom' => '-20037508.34',
        'top' => '20037508.34',
      ),
    ),
    'controls' => 
    array (
      'MousePosition' => TRUE,
      'ScaleLine' => FALSE,
      'LayerSwitcher' => FALSE,
      'Navigation' => FALSE,
      'ZoomBox' =>  FALSE,
      
    ),
    'styles' => 
    array (
      'default' => array (
      'pointRadius' => 5,
      'fillColor' => '#FFEF00',
      'fillOpacity' => 0.5,
      'strokeColor' => '#FFEF00',
      'strokeWidth' => 2,
      'strokeOpacity' => 1,
      ),
     
      'select' => 'default',
      'temporary' => 'default',
        
    
    ),
    'layers' => 
    array (
      'openlayers_layers_google_hybrid' => 'openlayers_layers_google_hybrid',
      'openlayers_layers_google_physical' => 'openlayers_layers_google_physical',
    
       
      ),
     







   
     
     
 

  'behaviors' =>   array(
    'ember_map_fullscreen' => array (
      'id' => 'ember_map_fullscreen',
      'type' => 'openlayers_behaviors_fullscreen',
      'default' => 'locked', 
    ),
  ),



 
  
  );
 
 
 
 
 
 $presets['sparcs_ember_map'] = array(
    'preset_name' => 'sparcs_ember_map',
    'preset_title' => t('SPARCS Ember Map'),
    'preset_description' => t('This is the basic EMBER Preset  for the SPARCS Mapping module.'),
    'preset_data' => $ember_map,
  );
 
  return $presets;
}
spydmobile’s picture

I disabled the theme I was using and lo and behold the map rendered.
The theme is Pixture Reloaded and it uses the suckerfish or superfish menu for javascript menus. I am pretty sure that this is part of the problem and may be why some folks have the issue and some dont, I think that its related to drop down menus and IE crap....
Working around this problem by setting the theme to something simple with little or no javascript.

Anonymous’s picture

I've been struggling with this issue all day today. I've stripped all the javascript from my theme and disabled all modules that add javascript. Only OpenLayers is adding scripts. I still can't get the map to display in IE7, and it's stopping at the same lines mentioned in #13.

Anonymous’s picture

Status: Needs review » Active

The patch in #3 doesn't have any effect on the problem, so this is still active.

FWIW, I cannot visit http://sandbox.zzolo.org/openlayers-views-example and see a map, but I don't know what version of the module this site is running.

tmcw’s picture

Status: Active » Needs review

bangpound, which version of OpenLayers are you using (or how old is your dev version) and what source are you using for the OpenLayers javascript? This issue should be fixed by this revision of the 1.x branch and recent OpenLayers.

Anonymous’s picture

I'm running current CVS DRUPAL-6--1 of OpenLayers module and OpenLayers 2.8 javascript. I have that line in my openlayers.js script.

zzolo’s picture

I know how ridiculous IE JS debugging can be, and I am not sure what your environment is, but maybe there is some way to get some real debugging information:

http://notetodogself.blogspot.com/2008/08/debug-javascript-in-ie.html

Otherwise, its just kind of shooting in the dark. Also, the example at my sandbox is fairly old.

Anonymous’s picture

I'm trying with the newer debugger listed in the article from zzolo. I'll be back.

Anonymous’s picture

I have a semi working map by adding:

xmlns:olv="urn:schemas-microsoft-com:vml"

To my page.tpl.php html element.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:olv="urn:schemas-microsoft-com:vml" xml:lang="<?php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>">

Still not 100% though. And it took me ALL DAY to set up that Microsoft whatsit Express, and it is the best JavaScript debugger I've ever used.

Anonymous’s picture

Ok. Here's my complete fix:

1. Add olv namespace to your page template. xmlns:olv="urn:schemas-microsoft-com:vml"

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:olv="urn:schemas-microsoft-com:vml" xml:lang="<?php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>">

2. Add this style to your IE or general stylesheet.

olv\:* {
  behavior: url(#default#VML);
  position: absolute;
  display: inline-block; }

(The backslash colon asterisk is important!)

The OpenLayers javascript was failing in OpenLayers.Renderer.VML initialize function, which tested for the existence of the olv namespace. If it didn't exist, it would create it and add few styles to a new stylesheet. My script was failing on the attempt to create a new stylesheet.

zzolo’s picture

So, what's the best way to handle putting this into the module? The CSS is simple enough (though so hackish), but the template stuff gets a little more difficult to do well.

I suppose, we just include that information in the README.txt?

BWPanda’s picture

I just updated to the latest dev version and tested in IE without applying any patches - it seems to be working...

tmcw’s picture

Can everyone post which IE and which OpenLayers version they're using?

At least from everything I've seen, IE8 doesn't have the difficulties with VML that IE7 and IE6 has, and that the newer version of the OpenLayers library (dev, sadly there is no 2.9 release yet) has fewer problems with the VML rendering than 2.8.

Also, there's an inconsistency in the code that I think has a serious effect on this: between internal and external openlayers sources, the Javascript is included in different ways

    if (valid_url($path, TRUE)) {
      // If URL, we have to manually include it in Drupal
      drupal_set_html_head('<script src="'. check_url($path) .'" type="text/javascript"></script>');
    }
    else {
      drupal_add_js($path);
    }

I think that this ends up with the OpenLayers.js code being included first in some cases and after openlayers.js in other cases, thus making the document.namespaces; trick sometimes work and sometimes fail.

There's some documentation on this in the handbook page and more in the openlayers FAQ.

Anonymous’s picture

I'm using IE7 and OpenLayers 2.8 hosted in my Drupal site not from openlayers.org.

BWPanda’s picture

I was testing both IE7 and IE8, and my OpenLayers.js is taken from their website (and hosted there).

zzolo’s picture

So, what is best solution for this problem. It seems like it is something that has to go in the page.tpl.php, if I understand this correctly?

If so, we can't automate it this in the module, and will just have to have good documentation in the installation file and on the project page.

This seem right?

tmcw’s picture

The eventual solution here is probably to move the OpenLayers initialization from the onReady handler, which is provided by Drupal's behaviors stack, to another stack based off of simple jQuery callbacks and runs on onLoad. The problem at its core is that Drupal is making us run this before page load, when the VML stack is not ready in IE, and thus we're practically the only consumers of the OpenLayers library who have this problem and can't fix it by just relocating the code.

Anonymous’s picture

Perhaps drupal_set_html_head() can be used to add OpenLayers whether the script is hosted on the drupal site or on openlayers.org? This would deal with another issue I've found... the javascript aggregator isn't told not to aggregate the openlayers library, and i think at a few hundred kilobytes, it's definitely not well suited for it.

phayes’s picture

I agree that moving thing to drupal_set_html_head is a good interim solution. It isn't the 'drupal way', but the drupal way isn't working for us at the moment.

tmcw, eventually I would like to be able to call up maps using ajax or ahah (which as far as I know needs to use drupal behaviors to trigger javascript) - how do you think moving things to jquery would affect this eventual goal?

zzolo’s picture

Just to note why openlayers is included in two ways: it is because drupal_add_js() does not allow for external JS.

Does this problem exist in 2.x? I would assume so.

So, for the ideal solution, in my opinion, we continue to use Drupal behaviors, but we need to test to see if the event is the onReady event, and not do any OpenLayers processing. This will take care of the error, then we can just do regular jQuery onLoad event that calls the Drupal behavior. This way we are still utilizing Drupal behaviors, but ensuring that processing happens at the right time. This is assuming we can somehow determine that the event is the onReady event within the Drupal behavior function. If not, maybe we can do a simple counter which looks for the first behavior trigger (this definitely seems hackish).

I have made a patch for this for 1.x-dev.

Also, if we move the processing to the window load event, then we are waiting for lots of things that could be pretty annoying. We could always just do this just for IE.

But looking at the "hack" in http://drupal.org/node/613002, I feel that it is a more simpler work around. If this works, I would rather use this workaround.

I am not really able to test the IE stuff all that consistently, so any help is appreciated.

tmcw’s picture

So, for the ideal solution, in my opinion, we continue to use Drupal behaviors, but we need to test to see if the event is the onReady event, and not do any OpenLayers processing. This will take care of the error, then we can just do regular jQuery onLoad event that calls the Drupal behavior. This way we are still utilizing Drupal behaviors, but ensuring that processing happens at the right time. This is assuming we can somehow determine that the event is the onReady event within the Drupal behavior function. If not, maybe we can do a simple counter which looks for the first behavior trigger (this definitely seems hackish).

This doesn't seem feasible. If we delay map rendering to the onload event, then we need to delay all other behaviors till after that, since all of them depend on a map object existing and functioning. And with the proposed workaround, all behaviors will be called twice, including those not in the OpenLayers behaviors stack. Having some kind of simple jQuery method for calling OpenLayers behaviors would avoid these problems.

Also, if we move the processing to the window load event, then we are waiting for lots of things that could be pretty annoying.

You mean waiting for the page to finish loading? I suppose so, but the difference, I'd guess, is pretty minor, and I really don't think it's very significant. The bottlenecks of OpenLayers performance are mostly in its own rendering process, not in when its called.

Does this problem exist in 2.x? I would assume so.

By using a recent version of OpenLayers and the document.namespaces hack, I've been able to avoid this problem in recent sites. You can see for yourself if it works in IE7, the new afghanistan site is using OpenLayers 2.0 (well, 0.x-ish).

tmcw, eventually I would like to be able to call up maps using ajax or ahah (which as far as I know needs to use drupal behaviors to trigger javascript) - how do you think moving things to jquery would affect this eventual goal?

Somewhat, this would give you a stack you could invoke at a different time than pageload, although I think it's also pretty feasible to just build something from scratch to do AJAX loading of new maps.

Perhaps drupal_set_html_head() can be used to add OpenLayers whether the script is hosted on the drupal site or on openlayers.org? This would deal with another issue I've found... the javascript aggregator isn't told not to aggregate the openlayers library, and i think at a few hundred kilobytes, it's definitely not well suited for it.

Yeah, that's exactly what I would suggest. And, OpenLayers is one big, big library, and it's best to run a minimized version anyway, I really wonder how Drupal's javascript aggregator stacks up versus jsmin / closure compiler. I suppose the big thing that you'd lose going with all set_html_head is that the aggregator framework might gzip contents? Or maybe not, if it's caching...

zzolo’s picture

tmcw, thanks for the detailed information.

If we consider this a bug with IE, I would definitely vote for the current namespsaces hack. It does not seem right to bend so much, just for a browser bug, when a small hack can fix it.

If it is an actual architectural issue problem with Drupal.behaviors and the OpenLayers library, then going with tmcw's suggestion on abstracting the behaviors model with jQuery.

But, from what I understand (and I could be wrong), this is a bug in IE.

kaakuu’s picture

Keeping myself subscribed as I am having 'openlayers is undefined' error and map not showing in IE 7.
For me IE 7 was working okay but had a disc format and downloaded the latest IE 7 from MS site today, and now I am having problem. FF is okay - no problem.

I will do more test with IE 7 and the fixes suggested here, making these notes to keep myself subscribed.
I am also trying to read the latest on this http://74.125.153.132/search?q=cache:DqK1_uOSLzAJ:trac.openlayers.org/ti... at openlayers site but the site seems to be down.

zzolo’s picture

@kaakuu, what specific version of openlayers are you using?

kaakuu’s picture

@zzolo, Thanks for the query. I am at my wit's end as to what is happening (curse IE)

So far I have been using 6.x-1.0-beta3, and with the Internet Explorer 7 version I was having I had no problem. Now I have the IE 7 latest version downloaded from MS and problems started (explaining why some friends also could not see in IE 7) - that 'undefined' error message.

Now I upgraded to 6.x-1.0-beta4. The error message is gone, geo-location entered per node is okay but the Views Tracker that shows all or multiple nodes as 'round orange points' is NOT seen in IE. Refresh, clean cache, disk clean - still not seen! But manually change zoom (just minutely slide the +/- slider slightly) they can be seen again. Do a page refresh - revisit page, they are gone. Gone means invisible, but apparently they are there as map shows up (map setting has been done not to show empty map). PLease help !

So, to sum up, using latest Openlayers beta, latest Drupal 6.15 and latest stable Views, IE no longer shows error message but also no longer shows multiple node locations compositely on a map as those 'round orange points'.

zzolo’s picture

@kaakuu

Are you uisng FF wtih Firebug, are there any JS errors. I have seen this before, but it usually caused by some other bad JS on the page.

--
zzolo

zzolo’s picture

Status: Needs review » Fixed

Moving to new ticket, as this has now become a support request: #680516: IE7 having issues displaying features consistently

I believe the IE part of this has been resolved and therefore closing. Re-open if we should not be using the hack solution.

netrom’s picture

I followed the instructions as described in #22. And the maps are actually now showing in IE.

BUT when adding polygons, points etc. they don't show in IE (in FF they do). It seems that they are registered as they appear in the WKT field but they do not show on the map.

Context: I use the 2.8 hosted version on D6.14.

Any one who knows how to solve this?

kaakuu’s picture

@netrom - this is the problem I am facing too. I need to do more tests as soon as I get some time.
I was not having this problem with old version of I E 7 but the latest (and safest!) version of I E 7 is giving me the same problem as discussed by you. I think you should join this issue now #680516: IE7 having issues displaying features consistently with details like what version of IE, any other JS, firebug output etc. We really need some quick workaround or solution for this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tmcw’s picture

Status: Closed (fixed) » Needs work

Reopening. A solution wasn't found, and at the very least, we need thorough documentation.

zzolo’s picture

Is this something that affects all branches?

zzolo’s picture

Implemented redraw fix in 1.x branch: http://drupal.org/cvs?commit=330102

Some related notes here: #680516: IE7 having issues displaying features consistently

zzolo’s picture

Status: Needs work » Needs review

Oh yeah. Please note that I dont have any version of IE readily available, so if someone can test this out, that would be very appreciated.

zzolo’s picture

pahyes pointed out that I forgot about the window load.
http://drupal.org/cvs?commit=330170

phayes’s picture

Status: Needs review » Fixed

This appears fixed for me running with the latest commit (#47). Marking as fixed.

netrom’s picture

I am using the hosted openlayers 2.8. I see no changes and still having the problem of points not showing in IE (6, 7, 8).

tmcw’s picture

netrom: are you using the latest 1.x release or the dev version? Can you give any more information about your setup, or an error message?

phayes’s picture

netrom,

Please open a new issue, detailing the specific problem you are having, with as much detail as possible.

netrom’s picture

I am having the problems as mentioned in my comment at #40 in this thread.

I am using openlayers: 6.x-1.0-beta4

And also, as mentioned I, am using the hosted version which means, I guess, that the .js file used is not the one in the module but the one hosted (?).

Should I use the 1.x-dev instead?

zzolo’s picture

@netrom, can you update to latest 1.x-dev, please, as this should have the IE fix in it.

netrom’s picture

I have now updated to the 1.x-dev., cleared cache, run update.php etc.

But, the problem (see #40) is still there.

BWPanda’s picture

Priority: Normal » Critical
Status: Fixed » Needs work
FileSize
35.84 KB

I too am also still experiencing this issue.
I'm using the 6.x-1.x-dev (Feb 19th) version with the OpenLayers source: http://openlayers.org/api/OpenLayers.js

I've attached a screenshot of this issue with the error message showing (my site with this issue is: http://brat.info)
The map itself doesn't show, but takes up the right amount of the screen (width & height), and the controls show but not properly.
Tested in IE8 (with and without compatibility mode) (screenshot is from IE8 without compatibility mode).

Marking as critical and setting back to 'needs work'.

alexpott’s picture

I'm experiencing some really interesting IE issues (in IE7 and IE8 and using my site's openlayers.js version 2.8)

Originally I installed 6.x-1.0-rc1 and was getting the missing argument error on line 597 in IE

So I found this issue and read through all the comments and thought... ok lets install 6.x-1.x-dev as of 2010-Mar-03 as the patch has been committed

Then I got a new error this time not in the openlayers.js (from openlayers) but in sites/all/modules/openlayers/js/openlayers.js - i.e. js provided by the Drupal module - the error was on line 19 Error: not implemented... line 19 is

/**
 * This is a workaround for a bug involving IE and VML support.
 * See the Drupal Book page describing this problem:
 * http://drupal.org/node/613002
 */
document.namespaces = document.namespaces || {};

So I went and checked out http://drupal.org/node/613002 and it mentions broken images... so I checked the page for broken images - there were none.

Then I reread a lot of the above comments and implemented the suggestions from #22 (add IE xml namespace and some CSS) which still did not work...

So I reverted back to 6.x-1.0-rc1 (leaving the changes from #22 in) and now it works

zzolo’s picture

This is a change I did. I was running things through JSLint and it gives notices because this is not really a valid JS command. If you have time, you can probably just use the dev version, but revert that line to:

document.namespaces;
tmcw’s picture

Yeah... why was that line changed anyway? In 2.x, it's just document.namespaces;

zzolo’s picture

Like I said, JSLint complained because it is not a valid JS statement, so I figured I would make it a valid statement. Obviously it causes problems in IE (though not in FF). I'll take it out of 1.x this weekend.

alexpott’s picture

You're right...

Changing that line make openlayers maps appear in IE7 fine...

But I still required half of #22 to get it working... the css isn't needed but if I don't have xmlns:olv="urn:schemas-microsoft-com:vml" in the tag I get the missing argument on 597 in openlayers.js...

Perhaps something needs to go into the README.txt file to tell people to add this to their page.tpl.php?

zzolo’s picture

Priority: Critical » Normal
Status: Needs work » Closed (fixed)

Alright, @alexpott, I have put it back:
http://drupal.org/cvs?commit=337836

As far as the other issues in this ticket, I am closing this ticket and creating a new one. Please don't comment on this ticket. It is way too broad and seems to encompass different versions. Create a new more specific issue if you are having problems.

@BWPanda, your issue is here: #734552: Geometry Undefined