"Javascript is required to view this map"
| Project: | GMap Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | bdragon |
| Status: | duplicate |
I have all my maps setup using the gmap 5.x-1.x-dev and location module. I'm displaying CCK, location enabled nodes on the map. In the map configuration screens, the map preview displays fine (I can zoom, view everything, etc).
However, when I try and view the nodes at either /map/node or using a views block, I get a simple message that says:
"Javascript is required to view this map."
Now, I obviously wouldn't post this bug unless I had javascript turned on (and confirmed that) and checked in multiple browsers (just in case). Still no luck. Anyone else having this issue? Any thoughts on the problem? (I marked it critical since I can't use it at all until I find a solution)
screenshot attached just so you don't think i'm crazy
| Attachment | Size |
|---|---|
| javascript.png | 50.83 KB |

#1
Doh!
Apparently you need to have $scripts printing in the head for this to work. I had it at the bottom of the page for quicker page loading. When I moved it up to the head all is working as expected. (see, Yslow doesn't know anything ;) )
#2
I have this issue, but I have $scripts in the head.
I added a map to a node using [gmap zoom=3 |center=-41.244772343082076,173.3203125 |width=300px |height=200px |id=nelsonmap |control=Small |type=Map] (this was created via "create a macro") - input format = GMap
From the resulting webpage source, i have the following:
<head>
<some stuff>
<script src="http://maps.google.com/maps?file=api&v=2.111&key=my_google_API_key" type="text/javascript"></script>
<more stuff>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap.js"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/marker.js"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/gmap_marker.js"></script>
<script type="text/javascript" src="/sites/all/modules/gmap/js/poly.js"></script>
<script type="text/javascript">Drupal.extend({ settings: { "gmap_markermanager": [ ], "gmap_init": { "querypath": "/map/query" } } });</script>
</head>
<body>
<div id="gmap-nelsonmap-gmap1" style="width: 300px; height: 200px;" class="gmap-control gmap-gmapgmap gmap-map gmap-nelsonmap-gmap">Javascript is required to view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
Drupal.extend({ settings: { "gmap": { "nelsonmap": { "width": "300px", "height": "200px", "zoom": 3, "maxzoom": "14", "controltype": "Small", "align": "None", "maptype": "Map", "mtc": "standard", "baselayers": { "maptype": "Map", "Map": 1, "Satellite": 1, "Hybrid": 1 }, "line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior": { "locpick": false, "nodrag": 0, "nokeyboard": 1, "nomousezoom": 0, "autozoom": 0, "dynmarkers": 0, "overview": 1, "collapsehack": 0, "scale": 0 }, "markermode": "0", "id": "nelsonmap", "longitude": "173.3203125", "latitude": "-41.244772343082076" } } } });
/* ]]> */
</script>
</body>
Any ideas what is wrong here?
TIA
Tracey
#3
@UnicornSong:
For some reason, Drupal.extend is being called twice. I don't know whether that's normal behavior for your use case with this module, but I've never seen it before.
I think your issue is different than the original poster's, so it might have been better to post a new issue.
#4
My guess would be http://drupal.org/cvs?commit=120352.
#5
What a strange thing, I got this error too, using the June 12 dev, plus jquery update module (don't know if that's relevant).
I have a content-type that has a cck linkfield. When that field is empty, the map appears, when I fill it in, I get the Javascript is required to view this map error. Now the stangest part, when I give the linkfield a heavier weight so that it displays below the map, the map shows up normally. When above, it doesn't. I checked for any errors in the html syntax, and as far as I am aware linkfield does not use any javascript to interfere. Hope that helps
#6
This can also happen if map initialization fails.
#7
remember that " If you are using the HTML filter, it will need to appear BEFORE the GMap filter."!!!!
To modify the order of filters in an input format, click "Configure" on a format at admin/settings/filters and then click the "Rearrange" tab.
#8
I had the same problem and it drove me a bit nuts until I modified the map field - making it "hidden" in the teaser. Now it works just fine.
http://www.roadflix.ca/pei/drivingdirections
#9
This just started happing today when I installed Beta 2. Funny everything works fine with firefox, well maybe not so funny.
#10
I discovered this is an issue with 5.8 drupal.
A temporary fix could be copy the block module from 5.7
http://drupal.org/node/281094
#11
In my case I get the error if I don't put text in the body - easy cure of course
When I get the full hang of this module I'll be pleased but regardless of my skills keep up the good work
#12
I get the error when I put two maps in one node.
The first one shows but the second one gets the error.
It started happening after I installed Beta 2.
After I got the error I upgraded my drupal 5.7 to 5.9 but that did not help..
#13
Upgrading 5.8 -> 5.9 did help to solve this issue for me. GMap module is Beta 3.
#14
just upgraded to 5.9 and 5.x-1.0-beta3
breaks on Firefox 2.0.0.16
No problem with Opera, IE and Safari
Will update to latest Firefox and see if it still breaks
#15
works with latest Firefox.
#16
I have a fairly fresh Drupal install (5.9), latest betas of Location and GMap as of today, and Firefox 3.0.1, and was getting the "Javascript is required" message. Scripts seemed to be outputting correctly, no indication of anything going wrong. The only suggestion above that made it work was moving in the 5.7 blocks module, which, incidentally, has been the fix for a number of other strange problems encountered with 5.8/5.9. So, for those who don't think they have really bent their system out of shape yet, reverting to 5.7 blocks is the only effective thing I've seen so far.
#17
I got the same problem using the D6 version.
#18
I get the "Javascript is required to view this map error" when using the D6 version using both the lastest v3 Firefox and IE7. This seems to be on all places where the map might be displayed - including in the admin pages.
#19
I also have the "Javascript is required to view this map error". The error has not shown up with previous versions of the gmap module.
#20
I am having a similar issue - not sure if its the same though...
the locations all show in the various views- until the actual node.
in IE i get the Javascript error
in firefox the map displays but no markers.
this only happens in my custom theme.
#21
Same here.
Drupal 6 and Gmap Dev.
Something else is strange too.
Example code to at least see 1 map appearing: [gmap zoom=3 |center=-41.244772343082076,173.3203125 |width=300px |height=200px |id=nelsonmap |control=Small |type=Map]
All filters are on. Gmap is called first (weight-10)
Gives me a hefty blank page error:
Forbidden
You don't have permission to access /drupal/node/23/edit on this server.
Which is kind of sad to see when you are user/1.
Hope it helps. No maps for me yet....
Thanks
Mark
#22
Same issue here on Drupal 6.3. Same message in Firefox 3.0.1 and Safari 3.1.2. Demo google maps pages outside of drupal work fine.
Still developing the site, so I'm quite willing to send any diags or try out new code, no hurry.
One interesting thing in the source for the page:
<div style="width: 600px; height: 400px;" class="gmap-control gmap-gmapgmap gmap-map gmap-map-gmap" id="gmap-map-gmap0">Javascript is required to view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.extend(Drupal, { settings: { "gmap": { "map": { "width": "600px", "height": "400px", "zoom": 3, "maxzoom": "14", "controltype": "Small", "align": "None", "maptype": "Map", "mtc": "standard", "baselayers": { "Map": 1, "Satellite": 1, "Hybrid": 1 }, "styles": { "line_default": [ "0000ff", "5", "45", null, null ], "poly_default": [ "000000", "3", "25", "ff0000", "45" ] }, "line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior": { "locpick": false, "nodrag": 0, "nokeyboard": 1, "nomousezoom": 0, "autozoom": 0, "dynmarkers": 0, "overview": 0, "collapsehack": 0, "scale": 0 }, "markermode": "0", "longitude": "-40.60546875", "latitude": "44.715513732021336", "id": "auto1map" } } } });
/* ]]> */
</script>
That
<looks like a mistake.#23
For me, this problem solved itself when I deactivated Administration Menu (6.x-1.0).
#24
a-ha, didn't look for module conflict - the problem went away for me when I disabled Lightbox 2 (part of Brilliant Gallery). Thanks for the tip-off, now to figure out who is at fault. :)
#25
Nice one!
Lightbox 2 and Gmap are indeed noot really working wel together.
Macro builder seems to work. Made a macro.
When I put the macro in the node, all I get is:
Javascript is required to view this map.
/* */
http://www.wacon-int.com/drupal/content/welcome-wacon-international-ltd
What's happening? In the builder tool I get great maps!
#26
I do also get this problem. I am building a site using default garland theme and D6.3. Disabling both administration menu AND lightbox2 does not fix the problem. I have tried disabling everything but gmap and location, still this happens. I have run out of ideas.
#27
I am getting this same problem with D6.3 and have tried above suggestions with no resolution yet? A bit stuck as mapping feature is important for the new site I'm working on, and I don't want to have to revert to an older Drupal version just to get map working.
I should add I have yet to see a gmap on this site in any browser. It gives me the warning on the configuration page and macros.
I do not have admin menu nor lightbox2, and I have disabled countless modules to see if there is conflict and still can not fix this.
thanks to all who have replied and reply with suggestions:)
#28
In Drupal 6.3, I had the same problem when I had content from views and gmap on the same page. I'm using the insert_view module to insert views into content, using macros.
I figured out that I was getting the "Javascript is required to view this map" error whenever I had a gmap on the same page as a view that was using Ajax (it's an option in the view configuration)
When I turn off the ajax option, the gmap works properly. Firebug alerted me to this problem, as it was spitting out javascript errors.
I don't know if this is anyone else's issue, but I figured more information might help.
#29
Thanks for the suggestions aghman, although still not workin for me.
Tried to shut off ajax in all views (even if there are no views in map page), but still no map.
Also tried to completely shut off javascript in views. No help.
#30
hmm .. disabling the admin menu and lightbox2 modules removed the Javascript is required error on the following pages in (Both IE 7 and Firefox 3.01) :
But the map/node page - even though it displays the page with the map on it - does different things depending on whether I view it in IE7 or FF3.
In FF3, after displaying the map it seems to immediately redirect to 'somewhere' even though the url does not change but it results in a blank page and a never ending request to the server.
In IE7, it displays the map and then lays a copy of the current page over the top of the map in a closable raised div layer (with a little X in the top right corner of the div) ... weird.
The Javascript is required error still is present on the user/1/edit (edit user page) and node/1/edit (node edit page). (Both IE 7 and Firefox 3.01)
#31
same problem, on 6.3 with gmap-6.x-1.x-dev, waiting a solution, please help
#32
Hope it would be helpful, here with some of the js advices I got:
Avviso: assignment to undeclared variable G_API_VERSIONFile sorgente: http://maps.google.com/maps?file=api&v=2.115&key=ABQIAAAAkz-VugteYFBMz28... 1
Avviso: variable I redeclares argumentFile sorgente: http://maps.google.com/intl/it_ALL/mapfiles/115/maps2.api/main.js
Riga: 8, Colonna: 72
Codice sorgente:
function ha(a,b,c,d,e,f,g,h){var i=ga(g),k=ga(d);ia(i,function(w,I){var I=i[w],L=k[w];if(L)fa(a,L,I)});
Avviso: test for equality (==) mistyped as assignment (=)?File sorgente: http://maps.google.com/intl/it_ALL/mapfiles/115/maps2.api/main.js
Riga: 48, Colonna: 41
Codice sorgente:
function ac(a){var b;while(b=a.firstChild){$b(b);a.removeChild(b)}}
Avviso: variable a redeclares argumentFile sorgente: http://maps.google.com/intl/it_ALL/mapfiles/115/maps2.api/main.js
Riga: 198, Colonna: 187
Codice sorgente:
var jf=["opera","msie","applewebkit","firefox","camino","mozilla"],kf=["x11;","macintosh","windows"];function lf(a){this.type=-1;this.os=-1;this.cpu=-1;this.version=0;this.revision=0;var a=a.toLowerCase();for(var b=0;b<j(jf);b++){var c=jf[b];if(a.indexOf(
Avviso: anonymous function does not always return a valueFile sorgente: http://maps.google.com/intl/it_ALL/mapfiles/115/maps2.api/main.js
Riga: 289, Colonna: 67
Codice sorgente:
Ah.prototype.dk=function(a){if(this.S)return this.Gf.apply(this.S,a)};
#33
Hi,
I am having this issue, but it only appears in IE7.
On top of this, it's an issue that does not always occur. I have spent hours tweaking IE cookie, and security settings in the hope that one may stabilise this but to no avail.
Using IE8 and emulating IE7 i was able to produce this error:
Webpage Script Errors
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; MS-RTC LM 8; InfoPath.2)
Timestamp: Thu, 14 Aug 2008 06:52:54 UTC
0.
Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://bureau.nsa-aust.com.au/index.php?q=node/13
... but this looks like the old 'operation aborted' useless IE message, on a slighter move elevated level of uselessness.
Any help would be greatly appreciated.
Works perfectly in Firefox 2 , Firefox 3 , Opera .
Cheers
#34
Digging a bit deeper it seems to me that the JS in the 6.x.1.x-dev gmap version hasn't yet been completely converted to the Drupal 6 standards.
I say this based on reading this: http://drupal.org/node/114774#javascript-behaviors
And searching the javascript code in the gmap module.
Unfortauntely my JS knowledge is not that great so .. I don't feel confident enough to attempt a fix myself.
#35
I'm having this issue with gmap for a view, too, with D5.
View argument handling code:
$view->gmap_macro = "[gmap|center=0,0|zoom=1|width=430px|height=286px|control=Small|type=Map]";Clearing the cache temporarily seems to restore the google map and remove the error, but if you refresh the page it returns.
#36
I have the same issue, but I'm just using Dhtml Menu and Gmap at the same time.
inspired by rasmusb85 (#23), thank rasmusb85 btw, I deactivated the dhtml menu module, and then the gmap worked. i checked the error console of FF and found that there is an error message:
Error: effects has no propertiesSource File: http:// ... /sites/default/modules/dhtml_menu/dhtml_menu.js?j
Line: 43
the js code at line 43 is as the following
if (effects.clone) {so a simple guess is that effects is not defined yet here. a quick and dirty fix is to replace the condition by
effects && effects.cloneand similar problem happens at line 47 too.
after the changes, both the dhtml menu and gmap work. but i haven't checked lightbox.
cheers,
steve
#37
Hmm - another one - this time - d6 - wouldn't work anywhere - not even the generate a gmap macro - turned out (hint from higher up in this post) to be a views2 view in a block was throwing a JS error - "Drupal.settings.views is undefined" - disabled ajax - map came back.
#38
I've got the same issue with Drupal5.9 and GMAP 5.x-1.0-beta3, but it seems to fix in some instances if I turn off Tinymce (which is used in some the other CCK text fields in the map's content type)
I have no idea how to fix it properly, but hopefully this info might help anyone who does know
#39
Just changed the old tinymce module to the new wysiwyg module (with tinymce 2.1.3), updated jquery to 1.2.6 and then started to rebuild one of my map cck content types. All seemed to work OK with the location map showing in the add/edit page, until I added an cck_imagefield field and then the map disappeared...as soon as I remove the image field the map appears again
#40
This is sounding like you guys are having js errors elsewhere that are stopping gmap from running...
#41
* Changed title back
@Bdragon - I get no javascript errors elsewhere (according to the firebug and the js console) .. until the gmap module is enabled. Once GMap is enabled and I try to go to the gmap config page (for eample) then I get underfined variable errors reported by other modules that worked just fine prior to enabling the gmap module.
If you see my comments above you will see one where I think its possible that the D6 version of gmap has not had its JS completely ported yet and I was thinking that perhaps that might be why other modules break when gmap is enabled.
#42
Hi,
I also have this problem on a 6.4 install with Gmap module.
When I go to the macro builder, I have this sentence : "javascript is required to view this map".
However, the google map correctly appear in the gmap admin setting page.
Any ideas about it ?
#43
Hmm, I unabled all javascript related modules, and the map now appear so I think it can come from one of this module :
Nicemenu
Jtooltip
Shadowbox
PS : Administration menu cause problems too, but even the map in setting page don't appear with it so I already desactivated it....
I don't know if these problems are an each module issue or if it's a gmap issue...
#44
@zmove: I went through the same process as you, disabling all other modules that reported javascript errors when the gmap module was enabled and although I managed to reach a point where the Javascript is required error disappeared from most places that it previously appeared I still got it reported when trying to edit a node that had a gmap.
What gets me is that these modules functioned just fine with no javascript errors and still do if I disable gmap ...
#45
Been looking at this even more. Any views2 view on the page with ajax enabled - this error. Install extlinks module - which tags external links using js - this error.
With the ajax view of a views2 block - I get "Drupal.settings.views is undefined"
With extlinks involved I get "Drupal.settings.extlink is undefined"
It seems that enabling the gmap module is doing something to the initalization of Drupal.settings.*
#46
I believe that I just committed some fixes that should help a lot.
See #291162: Multiple Maps on Same Node, http://drupal.org/cvs?commit=135383, and http://drupal.org/cvs?commit=135388
#47
@bdragon : You Sir are a STAR!!!!! Those two commits made the Javascript problem go away - WOOO HOO
#48
Great work, for me is fixed.
#49
Yep - confirmed as a fix for me too.
#50
#51
I resolved this issue by turning off the devel module.
#52
I tried disabling javascript modules, but the only working solution was downgrading block.module to version 5.7, as read in other related issues.
This worked for me even if, I guess, it is not the best solution available, although very fast.
#53
bdragon, is there a fix for D5? Can you explain what you did?
I'm still having no luck getting GMap past this JavaScript issue. I'm using D5.10, with GMap dev, on a clean Drupal install with pretty much everything turned off.
#54
Hmm, no wonder I am having no problems with D5, my test site is 5.7-dev!
I'm going to update it now and take another look.
#55
Hmm, still can't reproduce.
#56
Have just downloaded and installed 6.x-1.0-beta4 and am still getting the problem. Other modules I have enabled are:
Image
Image Assist
Menu Breadcrumb
NodeAccess
Pathauto
Pathologic
Term Display
Views
Weblinks
but disabling one or more of these doesn't make a difference, and I'm not getting javascript errors from any of them.
The maps are visible when creating a macro or setting the defaults for Gmap, but not when the macro is pasted into a node.
#57
Still getting the "Javascript is required to view this map" error after installing 6.x-1.0-beta4.
Maps are only visible without the error when creating the macros.
My Drupal is 6.4
#58
Drupal 6.4
GMap 6.x-1.0-beta4
Location 6.x-3.0-test3
Seeing same Javascript is required error
#59
Same install and Javascript error as #58.
#60
I had this error after updating gmap and lightbox 2 on Drupal 5.10 . After reading this thread I went back and looked at the module version release dates.. Update status had me download the older version of these modules because I had installed Dev versions.
So, now Lightbox 2 and gmap are back to using these versions:
GMap Module 5.x-1.x-dev (2008-Sep-17)
Lightbox2 5.x-2.x-dev (2008-Sep-01)
And the problem has disappeared. (at least in Firefox)
#61
Same install and Javascript error as #58 except I'm using beta5. Also had lightbox2 which I disabled to no avail.
#62
So far I have seen this error only if a macro contains "align=Center".
I am using Drupal 6.4.
#63
I am having this problem when I insert the following into a page-node-[].tpl.php file right above print $content.
<?php
//base for the data location map
$map_array = array(
'id' => "dataLocationMap",
'width' => "100%",
'height' => "450px",
'latitude' => 16.9727,
'longitude' => 7.3828,
'zoom' => 2,
'align' => "Left",
'maptype' => "Satellite",
'controltype' => "Large"
);
$output = theme('gmap', $map_array);
print $output;
?>
But if I insert the macro produced code into the body section of a node it works.
I can look at the source and see that none of the gmap javascripts get printed. Am I calling something incorrectly?
#64
Yeah similar issue here. I'm gonna try dropping the module and just manually coding the javascript into my theme - might be simpler?
#65
Actually it turned out simpler to fix the module. The problem (at least in 6.x beta5) is just a CSS styling issue. Try giving your map an ID of "auto1map" and it will work. There must be something wrong with the default stylesheets... or perhaps this is by design but then it needs to be documented.
#66
I tried changing the map ID. For some reason the gmap javascripts are not being added to the "print $scripts" portion of the head. Has anyone else added a gmap array to a page.node.tpl.php file and had it display successfully? Any suggestions?
I am pretty sure it is because the gmap_doheader() is not being called or is being called to late.
EDIT: Fixed this by writing a block module instead of directly inserting code into the node template files.
UPDATE: Anyone else with this problem, try setting your Align to "None". I still had this problem after writing a block module and traced it to a CSS issue as stated before. I'm still not quite sure why the align is messing up, I just know that "None" is the only option that works for me.
#67
GOOD CATCH!
I can reproduce the align issue, looking into it now.
#68
OK, the issue with align is now fixed.
http://drupal.org/cvs?commit=143544
http://drupal.org/cvs?commit=143545
Does this fix the remainder of the "Javascript is required to view this map" problems that people are having?
#69
having the same issue, but only in node teaser view. I am calling a map with node.tpl with separate teaser and full node views. code is below.
All full node and views maps working great.
<?php if ($teaser): ?>
<!-- teaser template HTML here -->
<div id="node-map">
<?php
/**
* id - the id of the map every map on a page must have a unique id
* width - width of the map
* height - height of the map
* center - a string of the longitude and latitude of the centre of the map
* zoom - the zoom factor of the google map
* align - the alignment of the map 'right', 'left' or 'center'
* control - the control shown on the map 'Large', 'Small', or 'None'
* type - 'Map', 'Hybrid' or 'Satellite'
* points/markers - a string of points to mark on the map with + between each point
*/
$points = array(
'id' => 'map'.$node->nid,
'width' => '300px',
'height' => '150px',
'latitude' => $location['latitude'],
'longitude'=> $location['longitude'],
'zoom' => 5,
'controltype' => 'Small',
'maptype' => 'Map',
'markers' => array(array(
'markername' => 'blue',
'latitude' => $location['latitude'],
'longitude' => $location['longitude']
))
);
print theme('gmap', array('#settings' => $points));
?>
</div>
<?php else: ?>
<!-- regular node view template HTML here -->
<fieldset class="fieldgroup gmap-node">
<legend>Map</legend>
<div id="node-map">
<?php
/**
* id - the id of the map every map on a page must have a unique id
* width - width of the map
* height - height of the map
* center - a string of the longitude and latitude of the centre of the map
* zoom - the zoom factor of the google map
* align - the alignment of the map 'right', 'left' or 'center'
* control - the control shown on the map 'Large', 'Small', or 'None'
* type - 'Map', 'Hybrid' or 'Satellite'
* points/markers - a string of points to mark on the map with + between each point
*/
$points = array(
'id' => 'map'.$node->nid,
'width' => '561px',
'height' => '165px',
'latitude' => $location['latitude'],
'longitude'=> $location['longitude'],
'zoom' => 5,
'controltype' => 'Small',
'maptype' => 'Map',
'markers' => array(array(
'markername' => 'blue',
'latitude' => $location['latitude'],
'longitude' => $location['longitude']
))
);
print theme('gmap', array('#settings' => $points));
?>
</div>
</fieldset>
<?php endif; ?>
#70
RC5 has fixed the issue for me. Thanks!
#71
The error has gone, but the map is always aligned left whatever "align" is set to.
#72
Verified, and fixed with a one character change. Thanks!
http://drupal.org/cvs?commit=143823
http://drupal.org/cvs?commit=143824
#73
I am continuing to see "Javascript is required to view this map." as noted by others above.
I have Drupal 6.4. This error occurred with GMap 6.x-1.0-beta6 and with 6.x-1.0-rc1. I ALSO got this error when I tried to install and use the module "NodeMap" instead, which leads me to suspect that the error has nothing to do with the module code, but something else (either in Drupal or at Google). I am getting the error in Firefox, IE, and Safari.
It also seems to be sporadic (maybe something to do with caching) because when I FIRST brought up the site in Safari it worked, but then it did not work later.
#74
Yes I'm still seeing this error using D 5.11 and Gmap rc1 but only in IE 7 and IE 8... and only on the node view.... just got done making sure javascript is enabled...
#75
What modules are you using? It could be an error in another js file getting gmap stuck...
#76
I just updated all modules to current releases using update status for 5.x and the error went away... my bad thanks...
#77
This error appeared when I toggled on the "Terrain: Physical feature map." map type in GMap module configuration. Unchecking this option removed the problem.
#78
Same error with Drupal 6.6.
Inserted this
[gmap markers=big red::46.020234816036385,11.905059814453125 |zoom=10 |center=46.00745484843494,11.918106079101562 |width=600px |height=400px |id=myId|control=Small |type=Map]
Tryed many different options in the configuration but none worked.
#79
For me, it turned out I had forgotten to include <? print $head; ?> in my custom theme.
#80
I'm using gmap_addons, and when I add a cck field on a node, it messes up the javascript of both "hierarchical select" and "fckeditor fields". Either gmap field or one of the js fields works ok. but not all. (when I remove the gmap field, all the other fields work ok)
So I'm pretty sure it's about a js file of gmap (possibly gmap.js) because the others work together pretty good.
#81
After disabling some of the additional marker options. It's functioning properly now.
#82
I'm also getting this error for node-based locations, ie, the user has entered a node-based address, and the map should be showing in the "Location Map" block that is enabled. I can see the /map/node map, however. (5.x-1.x-dev version of this module, Drupal 5.8. This also applies to 5.x-1.0-rc2.)
For node-based locations, nothing seems to be loading in the head of the page related to the display of a map, not like the /map/node page anyway. No js, no css, no script import from google itself, nothing.
#83
I have found that GMaps does not work with the Blueprint Theme.
#84
Putting
<?phpprint $scripts
?>
#85
I'm also getting the same error when I check the "Use a Google Map to set latitude and longitude" box. I can see my maps in on the node locations, and user locations pages. The locations even show up as they should. If I make a new event, for example, and set it's location, or a new user location, the map there is just a big blank with "Javascript is required to view this map." printed over it. I tried it on all themes too with the same results.
EDIT:
I just fixed it all for me by turning off "Optimize JavaScript files:" in Performance. My TinyMCE menu works better now too.
#86
I'm getting the same "Javascript is required to view this map." error in 6.x-1.0-rc2. I took the sample code from API.txt and called it from a hook_menu() function:
$items['xyz-usermap'] = array('title' => t('Map of Feed Locations'),
'page callback' => 'xyz_gmap_render',
'access arguments' => array('access content'),
'weight' => 5,
'file' => 'xyz_gmap.pages.inc',
);
The xyz_gmap_render() function:
function xyz_gmap_render()
{
$map_array = array(
'id' => "my-map", // id attribute for the map
'width' => "400px", // map width in pixels or %
'height' => "400px", // map height in pixels
'latitude' => 41.9023, // map center latitude
'longitude' => -87.5391, // map center longitude
'zoom' => 7, // zoom level
'maptype' => "Map", // baselayer type
'controltype' => "Small" // size of map controls
);
return theme('gmap', array('#settings' => $map_array));
}
This generates that Javascript error message. Firebug reports the error as well:
obj.vars is undefined.which points to this line in gmap.js:
// Load google map types.200 if (obj.vars.baselayers['Map']) {
201 opts.mapTypes.push(G_NORMAL_MAP);
202 opts.mapTypeNames.push('Map');
203 }
I'm using a modified Salamander theme with both $head and $scripts being loaded in the head of page.tpl.php. A View Source Chart shows that the following Gmap CSS and Javascript files are loading:
gmap.css?egmap.js?e
gmap_marker.js?e
poly.js?e
I also see this in the head:
<script type="text/javascript"><!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "gmap_markermanager": [ ] });
//--><!]]>
</script>
Optimization is disabled. I've tried this with the Devel module both enabled and disabled. Same deal.
#87
Just to follow up... completing a Drupal upgrade to the latest version of core seemed to do the trick. It works now, for the most part.
Ryan
#88
I was having this problem with the following code:
<?php$map = array(
'id' => 'contact-map',
'latitude' => $node->field_latitude[0]['value'],
'longitude'=> $node->field_longitude[0]['value'],
'zoom' => 10,
'width' => '480px',
'height' => '300px',
'maptype' => 'Map',
'controltype' => 'Small',
);
print theme('gmap', array('#settings' => $map));
?>
I tried using the macro text parser function and it worked fine. I really wanted the array syntax to work and I found that the hyphen in the id value is causing the problem. The following is tested and work with 6.x-1.0-rc2 under Drupal 6.6:
<?php$map = array(
'id' => 'contact_map',
'latitude' => $node->field_latitude[0]['value'],
'longitude'=> $node->field_longitude[0]['value'],
'zoom' => 10,
'width' => '480px',
'height' => '300px',
'maptype' => 'Map',
'controltype' => 'Small',
);
print theme('gmap', array('#settings' => $map));
?>
#89
subscribing
#90
ooh, reproducability, yay!
Investigating.
#91
Err, it's the mapid name. It seems it doesn't like hyphens.
#92
DOH!
http://drupal.org/cvs?commit=159669
#93
Thanks, bdragon! ;)
#94
Patch to gmap.js above: is this fix for d5 version? i can't find the line you referred to in the patch.
I took a look at another issue which solved the problem for me. I am not sure it will help iwth the version on D6 but I cross posted it here just in case it works here:
http://drupal.org/node/286653#comment-1165171
#95
Hi,
Still not working for views.
Getting Javascript is required to view this map when using code in page.tpl.php : like http://drupal.org/node/266595#comment-1108406
My code is:
<?php
$homes=array('id' => 'outmap',
'zoom' => 4,
'width' => '300px',
'height' => '200px',
'type' => 'Map',
'latitude' => $location['latitude'],
'longitude'=> $location['longitude'],
'markers' =>
array( array('markername' => 'blue',
'latitude' => $location['latitude'],
'longitude' => $location['longitude']
))
);
$outmap = theme('gmap', array('#settings' => $homes));
print $outmap;
?>
When using
if ($teaser != 1 )The map shows when I am not in teaser mode, so the code must be ok.
Thanks a lot in advance for going into this.
Greetings,
Martijn
#96
Err, you shouldn't be doing it from inside page.tpl.php, that's too late in the cycle. Do it anywhere before that and it should work.
#97
Hi Brandon,
Thanks for your quick reply!
Could you give a code example how to get say all nodes in taxonomy/term pages shown with markers on a gmap above the nodes?
Where to bring that in?
Thanks a lot in advance,
greetings,
Martijn
#98
Automatically closed -- issue fixed for two weeks with no activity.
#99
Have you all tried putting
<?php print $scripts; ?>into the<head>? Or applyingpatch from http://drupal.org/node/286653#comment-1199965 ? It solved
my 'Javascript is required' problem.
Try to turn off all JS-based modules - all Tabs, Text Size, External Links, etc...
Szy.
#100
Hi,
What worked for me was bringing the map within page.tpl.php AND node.tpl.php.
When I left the mapbuilding out of page.tpl.php it didn't show on node page.
page.tpl.php is for the page, and the full node view what I have read.
node.tpl.php is for teaser-mode of node view.
Maybe that's why the mapbuilding (not the map-showing) is needed in both files.
See for example: http://www.reizen-naar.nl/vakantiewoning
If somebody knows how to center the map so all spots are nicely shown, please tell me.
Greetings,
Martijn
www.reizen-naar.nl
#101
There is a bug within teaser.js which is affecting gmap and any other javascript features. You can applay this patch to fix it: http://drupal.org/node/336517
#102
Hi Robert,
On that page it says, it failed testing...how to proceed please?
Thanks a lot in advance for your reply!
greetings,
Martijn
#103
Well, that test is for drupal 7. It means that this patch, if applied to drupal 7 (drupal head for now), it might fail (in fact, it has passed the test for 54 times against 1 failed for user language settings). I would say you should be fine to apply this patch against a drupal 6 installation.
#104
This is the issue for D.6 on the teaser bug which is triggering this error: http://drupal.org/node/395828
#105
Automatically closed -- issue fixed for 2 weeks with no activity.
#106
I am having the same problem on Drupal 6.10, so the problem is still there. Disabling DHTML Menu module solved the problem, but I need both modules.
#107
I just found a bug in the experimental changes to bootstrapping in HEAD. It would cause trying to start up multiple maps simultaneously fail in a weird way. (So, gmap in HEAD has been broken in regards to multiple maps for 3 weeks.. *sigh*)
http://drupal.org/cvs?commit=193506
#108
For the record, it's terrible practice to put javascript in the head of any page. Browsers _stop_ loading content until javascript is fully loaded, which slows page-rendering. This module _should_ work with the javascript loaded in the footer, where it belongs.
#109
I'm getting this js error as well, but only when I select 'Choose latitude and longiture fields' in the style options for GMAP. If I select Locations.module I get a blank page but no error.
Is there any information on how the datasource should be used? Ideally it should get the location from an address, but since the options are lat and long, I don't imagine that will work.
I thought that using a location CCK field might provide lat and long, but that gives the same error. Am I supposed to filter the CCK somehow?
Thanks,
Derek
PS:
Drupal 6.10
views 6x-2.5
gmap 6.x-1.1-rc1
location 6.x-3.1-rc1
#110
Can we please close this issue somehow? It keeps getting re-opened by people who have different issues that result in the same error message, to the point that it actually isn't helpful anymore.
I would unsubscribe from it, of course, but Drupal.org doesn't allow that :)
#111
it works when I add in the code: teaser=hidden.
but I can't add html codes.
#112
"Javascript is required to view this map." error when creating a GMap view.
Gmaps and Location appear to be functioning well - I've got some nodes (Stories) with maps in them and a Node location map that I like.
I tried to put my Node location map on the front page, and couldn't. Tried to rename it and put it in the Primary menu, and the renaming failed. The common recommendation on the forum to these things appeared to be - duplicate the Node location map in a View.
I haven't made a GMap view before, and I'm still not sure how to do it correctly, because each time I change the View style from HTML List, where it works fine, to GMap, which is what I need to get a map out of the view, I get the "Javascript is required to view this map." error.
I'm not at all sure that the fixes noted recently are addressing the same problem I'm having.
All of this has been freshly installed:
Drupal 6.10
Gmap 6.x-1.1-rc1
Location 6.x-3.1-rc1
WsyiwygAPI 6.x-2.0-alpha1
Theme: Zen 6.x-1.0
Thank-you.
#113
Hi, I put the map code in node.tpl.php AND page.tpl.php then it worked for me.
greetings,
Martijn
#114
Suggestion that I try the dev version of GMap module didn't change anything. I uninstalled ALL modules, then reinstalled them one by one and the problem went away. I'm now using the GMap dev, not rc1. Thanks especially to Sean Effel.
#115
I've just added a new theme to my current project, migrating the base theme from Zen to Blueprint. Blueprint (correctly) puts $script at the end of the HTML BODY, whereas Zen has it at the top of the document in HEAD. Now I, too, am getting the
Javascript is required to view this maperror *sigh*#116
Even with the dev version I'm having that problem. Solved temporarily by disabling Ajax in the view, as posted in http://drupal.org/node/315236#comment-1800740.
Perhaps has to be with what is said here: http://drupal.org/node/313416#comment-1044935
#117
Hi!
I'm sending you a patch that solved my problem. The patch is agains 1.1-rc1!
The reason why it broke sometimes, is because jQuery was not loaded (for example because it was in the end of the file), and you cannot use jQuery.extend then.
Inlining the script with drupal_add_js() solves the problem.
#118
For anyone having the same issue as snorkers or Coornail, I recommend that you apply the patch in #286653: Patch to use JS Aggregation or JS at the bottom of the page. It is RTBC and will resolve any issues with jQuery not getting loaded before the Gmap JS. It's also cleaner than the patch in #117.
Also, can we flag this issue as a duplicate of something (possibly the issue I just mentioned since that's what the problem was for the OP, as well as some others), or otherwise close it? It's become like flypaper for all sorts of unrelated Gmap issues.
#119
@EvanDonovan thanks for the patch tip. Applied it and moved $scripts to the bottom of my page.tpl.php. Seems to work fine in my Blueprint based theme, although a little bit of map tiling snags in the Admin/Slate theme (only seems to render the area to the upper left of the map window).
I think you are right in this issue, it does look like a duplicate of #286653: Patch to use JS Aggregation or JS at the bottom of the page, as that is looking at the root cause of the problem
#120
closed because the issue mentioned above better addresses the problem.
#121
Not changing status, but another complication I found which leads to this error on occasion is permissions. In my case it was loading the location of the node as a block and returning "javascript is required..." for only not-logged-in users.
I haven't found the exact science to fixing this, but it seems to be a mix of:
Rebuilding site content permissions
Specifying block role permissions - then unspecifying (or re-specifying to original setup, YMMV)
clearing caches
#122
Hey Summit, if you haven't done this already, inside the Gmap settings, you can turn autozoom on. It will zoom your map so it contains all of your markers.
#123
Hi Mark, I will experiment with it, thanks for the tip!