Hi,
Before anyone points out, I know there was another issue raised with this problem (http://drupal.org/node/266595). This got closed without publishing a solution, well a solution that worked for me.
I am using Drupal 6.8, have downloaded the latest dev release of GMap module (dated 6th Jan) in the hope that would solve the problem).
I have created a view that shows a map of specific types of nodes. This appears to work fine and I do not see any errors. However, I have another page that inserts the view (using insert_view module). The map sometimes displays fine and I can confirm that the following is in the code for the page:
<script type="text/javascript" src="/sites/default/modules/gmap/js/gmap.js?N"></script>
However, more often I get an error saying "Javascript is required to view this map." and the above is not in the code for the page. It is the same page, the same code, so why should this be in sometimes and not others?
Cheers,
Nick
Comments
Comment #1
nickbits commentedHi,
I have just downloaded the latest Dev release, 14th Jan, and still get the same problem.
Nick
Comment #2
nickbits commentedHi,
Any update on this?
Nick
Comment #3
szy commented-> http://drupal.org/node/266595#comment-1211750
...?
Szy.
Comment #4
nickbits commentedHi Szy,
thanks for the suggestion, however, I created this issue as that one was closed and I have already tried what they suggest with no luck. Am going to have a look at http://drupal.org/node/286653#comment-1199965, but as far as I am concerned, this should work out of the box.
Nick
Comment #5
bdragon commentedI'm guessing it's something trying to insert a map too late in the theming and not being able to add scripts to the header.
Comment #6
bdragon commentedOr possibly a caching issue. Installing insert_views to have a look.
Comment #7
bdragon commentedCan't reproduce. Could you describe your setup in more detail?
Comment #8
nickbits commentedHi,
I am using insert_views, as I said in the original issue. Lets run through the issue again. I create a view that shows a map of the loactions for a specific node type. I can display that view with-out any issues at all. When I insert the view using "insert_views", sometimes the map will display, others it comes up with the JavaScript error.
Example of where I am using the insert view:
http://thatchamhistoricalsociety.org.uk/resources/maps
When I get the error, if I look at the code sent to the browser, the gmap JavaScript file is not included in the scripts at the top. And YES, print $scripts is in the theme. And yes, I have tried other themes and still get the error.
Nick
Comment #9
nickbits commentedHi,
Have downloaded latest Dev version (31st Jan), but still get the same error. Take a look at link in previous post.
Nick
Comment #10
bdragon commentedHmm, that's odd, there's slight evidence of corruption on the map data (the opening less than on CDATA is being expanded.)
Which usually means something is filtering after the map is expanded...
Investigating.
Comment #11
bdragon commentedHmm, looks like that was a filter order thing. It didn't affect my test site though.
Could you describe your input format, including the rearrange order? Could I also get a list of enabled modules, and what your performance settings under admin/settings/performance are? Also, could I get an export of the view?
Comment #12
nickbits commentedHi,
Yep, the filters I have, in order are:
1. insert view filter
2. Line break converter
3. HTML corrector
This is the order they were in last time the map worked. I have tried differing orders but do not seem to be able to get it to work. What I may have to do is put the text I want in the header of the view. That would solve the problem for this page, but there are other pages for which I cannot do this so would like to be able to get to the bottom of it if pos.
The view I know is fine, it's just when it gets embedded it is a problem.
Will post the rest of the info you requested later.
Cheers,
Nick
Comment #13
Jaap Haitsma commentedI have also the problem that I see "Javascript is required to view this map".
E.g. overhere
http://www.hightechstartups.nl/investors/3i
The weird thing is however is that sometimes it works and when I login it works all the time. It seems to be some timing related issue. If I can help providing more details let me know. I'm running drupal 6.9 with the latest release of gmap
Comment #14
szy commented@guzzi, just find another Drupal site where Gmap works and compare: map's place
in HTML code, reference to script at maps.google.com and all Gmap module's scripts.
During my first visit there was no map, only 'Javascript is required...'. But the map
appeared when I visited your site second time -> attachment.
... was it script, loaded succesfully from cache during second time, because
for the first time it was loaded too late?
Hope I am clear in my English-like writing ;)
Szy.
Comment #15
nickbits commented@guzzi, @szy, that is exactly what I get, sometimes it works, sometimes it doesnot. I have tried clearing caches, etc. but no luck.
@bdragon, the requested information:
Modules are:
----------------
Acidfree
Acidfree image
abuse
Admin Block
watchlist
Content
Email (cck)
FieldGroup (cck)
FileField (cck)
FileField Tokens (cck)
Link (cck)
Node Reference (cck)
Option widgets (cck)
text (cck)
Blog
Book
Color
Comment
Contact
Database logging
Help
Local
Menu
Path
PHP Filter
Ping
Profile
Search
Statistics
Taxonomy
Update Status
Upload
Date
Date API
Date popup
Date Timezone
Event
Image
GMap
GMap Location
Location
Advanced Help
DB Maintenance
FCKEditor
Feedburner
Global Redirect
Google Analytics
Iconizer
IMCE
Path Redirect
Path Auto
Service Links
Switchtheme
Token
Trackback
Twitter
Captcha
http:bl
recaptcha
External Links
Insert View
Views
Views UI
XML Sitemap
Performance Settings:
----------------------------
Caching mode: normal
PAge compression: Enabled
Block Cache Enabled
Optimize CSS - Disabled
Optimize JS: Disabled
Nick
Comment #16
nickbits commentedHi,
I initially thought this issue was 100% down to the GMap module. However, I now have problems with other views that do not use the GMap module. This has only just started, the common thing besides Views that connects them all, the insert view module. I am therefore assuming my problem is actually to do with this module rather than the GMap as it initially looked like.
Thanks for the help.
Nick
Comment #17
dan.crouthamel commentedI've recently come across this same issue, but only with Internet Explorer version 7. It works fine for me with Firefox, Chrome and IE8. In IE7 I get a 'GUnload' is undefined error.
And I should note --- it doesn't happen all the time. Sometimes it works :)
Comment #18
TylerRobertson commentedI fixed this issue on my end just by clearing the drupal cache
Comment #19
merilainen commentedI don't think clearing the cache is a solution. I've been fighting with this issue since the beginning of the year, and nothing seems to be the definite solution.
Patching the gmap module seems to make gmap work a lot better, see #286653: Patch to use JS Aggregation or JS at the bottom of the page for more info. Still not committed to dev version of gmap (?!).
I thought that patch mentioned above fixed all issues, but it just seems to make them happen less often. I'm using dev-version of location module, and after some update during July I'm getting this "Javascript is required to view this map" error again more often. I use dev-version because there were some SQL errors in my log reports coming from location_cck module, which are fixed in dev.
Now it seems to happen more often in the block where I want to show a CCK locationrelated to a node. I noticed that when the error comes, the code is
..."id": "auto1map", "markers": [ { "latitude": 61,497221, "longitude": 23,753521 ...in the scripts-element of the page and when it works the code is
..."id": "auto1map", "markers": [ { "latitude": 61.497221, "longitude": 23.753521 ...(commas have changed to dots).
There is a huge difference in the js-code between successful and unsuccessful loading of the whole map (page view). When it fails, there are 1675 chars, compared to 41000+ chars on working map.
This has to be some sort of timing or cache related issue, as some one mentioned already before.
Comment #20
ouwejan commentedI've had the same issue but it's fixed on our site.
Here's how, hope you'll find some clues to help.
The map worked fine untill we started caching. We're using custom caching btw. The only variable that changed whether the map or the Javascript notice was shown, was caching on or off. Luckily I managed to circumvent it bij placing the gmap_parse_macro and gmap theme call outside the cached code so they are always executed, caching or no caching. Don't know what actually is the thing that fixed it but this helped us. Good luck!
$macro = "[gmap align=Center|zoom=15 |center={$map['latitude']},{$map['longitude']} |width=768px |height=400px |control=Small |type=Map]";
$gmap = gmap_parse_macro($macro);
$marker['latitude'] = $gmap['latitude'];
$marker['longitude'] = $gmap['longitude'];
...
...
$gmap_display = theme('gmap', array('#settings' => $gmap));
Comment #21
Tamela commentedGreat suggestion!
What file was that in? gmap_location.module?
I found similar code in there but not exactly the same. I know just enough php to be dangerous. Could you explain a little bit clearer (dummy's guide)?
Thanks for your help!
Tamela
Comment #22
Phil Wolstenholme commentedI disabled 'Optimize JavaScript files' and saw my version of this issue disappear.
Comment #23
socialnicheguru commentedI am cross posting because I had a similar issue and took me a few hours to find
I had a specific issue of javascript error when I had a gmap in a panel page. It ended up being a javascript error caused by ctools.
the solution for me is here: http://drupal.org/node/888254
Comment #24
jamuy commentedNo usar AJAX render, con eso el script de google corre sin problemas.
Comment #25
peezy commentedSometimes this will happen if you don't have a valid API key. For example, I got this error using the same key on stage and dev.