function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RagingForceRagingForce 

hiding header makes javascript google maps functionality not work

Hi i have sites page that renders a google map but if i disable the header it does not work?

RagingForceRagingForce

Hi Looking further into this it stops working when i try to draw some markers on the map, this is done via apex web service class

 

here in the javascript i call the data to draw the markers:

 

 

 function AddMarkers()
  {
      var locList = sforce.apex.execute("CLocationGoogleMap", "GetLocationsInCity", {cityName:"{!Location__c.City__c}"});
      //alert(locList);

 

 function AddMarkers()  {      var locList = sforce.apex.execute("CLocationGoogleMap", "GetLocationsInCity", {cityName:"{!Location__c.City__c}"});      //alert(locList);

 

 

it seems to stop here in the sites page if hide the header, but if i show the header it works?

TopalovichTopalovich

 

You are likely referencing a JavaScript library that is no longer being called since you are not loading the header.  Look for that library and call it explicitly from your VisualForce page using the apex:includeScript tag.

 

Mike

 

 

regger118regger118

i am confused i am only using the google maps api v3 and apex javascript ?

TopalovichTopalovich

When you set the 'showHeader' attribute to false, you no longer load the common JavaScript libraries that are normally loaded when the header is present. Any scripts that are exposed when the header is loaded would have to be called directly from your VisualForce page.

 

For example, when I look at a page in one of my dev orgs using Firebug, I can see that the following scripts are loaded at runtime:

 

 

  • functions.js
  • main.js
  • en_US.js
  • desktopAjax.js

 

 

If I look at a page that is rendered with 'showHeader=false', these libraries are not present, and only the JS libraries that I reference explicitly are loaded at runtime.

regger118regger118

Interestingly this is where the error iswhen ia m trying to load my apex class in javascript?

 

 

Refused to set unsafe header "User-Agent"
  1. connection.js:1019Uncaught {faultcode:'UNKNOWN_EXCEPTION', faultstring:'UNKNOWN_EXCEPTION: Site under construction', }
    1. sforce.SoapTransport.sendconnection.js:1019
    2. sforce.Connection._invokeconnection.js:1624
    3. sforce.Apex.executeapex.js:60

 

regger118regger118

Interestingly this is where the error iswhen ia m trying to load my apex class in javascript?

 

 

Refused to set unsafe header "User-Agent"
CLocationGoogleMapPOST http://eunetworks.eundev.cs4.force.com/services/Soap/package/CLocationGoogleMap 500 (Internal Server Error)
XHR finished loading: "http://eunetworks.eundev.cs4.force.com/services/Soap/package/CLocationGoogleMap".

    connection.js:1019Uncaught {faultcode:'UNKNOWN_EXCEPTION', faultstring:'UNKNOWN_EXCEPTION: Site under construction', }
        sforce.SoapTransport.sendconnection.js:1019
        sforce.Connection._invokeconnection.js:1624
        sforce.Apex.executeapex.js:60
        AddMarkersLocationGoogleMapTest:81

 

 

sham_1sham_1

Have you granted permissions on the page / controller / webservice class for the sites ?