Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6247875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:57:19+00:00 2026-05-24T12:57:19+00:00

I am using http://maps.google.com/maps/api/js?sensor=false to retrieve latitude and longitude for address. While retrieving the

  • 0

I am using http://maps.google.com/maps/api/js?sensor=false to retrieve latitude and longitude for address.

While retrieving the data from google, I store the lats and lngs into arrays myLat and myLng.

The end user enters addresses into a textarea along with the names of the buildings which are also stored into their own arrarys schoolAddressArray and schoolNameArray.

I place the results in a div called results —

document.getElementById("results")

Then I take the constructed string and use eval to convert it into a “JSON like” object.

PHP start

global $browser;

if(strpos($_SERVER["HTTP_USER_AGENT"], "Opera") !== FALSE)
{ 
    $browser = "opera";
}
if(strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== FALSE)
{ 
    $browser = "msie";
}
if(strpos($_SERVER["HTTP_USER_AGENT"], "Firefox") !== FALSE)
{ 
    $browser = "ff";
}
if(strpos($_SERVER["HTTP_USER_AGENT"], "Safari") !== FALSE)
{ 
    $browser = "safari";
}
echo'
<script type="text/javascript">
<!--
var $whichBrowser = "'; echo $browser; echo'";
-->
</script>
';

PHP end

This is where the JavaScript starts

var strlen = tempVar.length;
var myNewTempVar = tempVar.slice(0,strlen-2)+']';
document.getElementById("results").innerHTML = myNewTempVar;
if($whichBrowser == "msie")
{
    //alert(document.getElementById("results").childNodes[0].nodeValue);
    markers = window.eval(document.getElementById("results").childNodes[0].nodeValue);
}
else if($whichBrowser == "opera")
{
    //markers = window.eval([getProperty(tempVar.slice(1,strlen-2))]);
    //alert(markers);
    //markers = [{ lat: 34.0878234, lng: -118.1543285, name: "1 school"}, { lat: 34.071239, lng: -118.1506133, name: "2 school"}, { lat: 34.1015362, lng: -118.1328816, name: "3 school"}, { lat: 34.098139499, lng: -118.1168382, name: "4 school"}, { lat: 34.0751855, lng: -118.1381771, name: "5 school"}, { lat: 34.0856624, lng: -118.1345840, name: "6 school"}, { lat: 34.0951319, lng: -118.1421722, name: "7 school"}, { lat: 34.0760016, lng: -118.1281349, name: "8 school"}, { lat: 34.0621694, lng: -118.1291052, name: "9 school"}, { lat: 34.0583261, lng: -118.1563075, name: "10 school"}, { lat: 34.046435, lng: -118.1524630, name: "11 school"}, { lat: 34.054128899, lng: -118.1280777, name: "12 school"}];
    for(var myX=0;myX<myLat.length;myX++)
    {
        markers.push(["{ lat: "+myLat[myX]+",  lng: "+myLng[myX]+",  name: "+schoolNameArray[myX]+"}"]);
    }
    alert(markers);
}
else
{
    markers = eval('('+myNewTempVar+')');
}

JavaScript End

As you can see, I use PHP’s

strpos($_SERVER["HTTP_USER_AGENT"]

to figure out what browser is being used by the end user followed by echoing some javascript to set the variable $whichBrowser. This has worked for me since early 2000s — BTW, I don’t know what to call that. The 90s are the 90s. Are these the 10s? The 0s?

Anyways, the code for IE, FF and Safari work fine, but I have tried everything that I could think of with Opera and it just will not see markers as an object.

I have copied the constructed string from the results div and hard coded it to see if it worked at all in opera, which it does with no errors at all.

I have also tried:

for(index in myLat)
{
 markers[index].lat = myLat[index];
 markers[index].lng = myLng[index];
 markers[index].name = schoolNameArray[index];
}

I have received errors ranging from cannot convert markers[index] into an object to Uncaught exception: RangeError: Maximum recursion depth exceeded

Here is the test data that I am using:

2821 W. Commonwealth Ave., Alhambra, CA
2001 S. Elm St., Alhambra, CA
110 W. McLean St., Alhambra, CA
100 S. Granada Ave., Alhambra, CA
1603 S. Marguerita Ave., Alhambra, CA
409 S. Atlantic Blvd., Alhambra, CA
301 N. Marengo Ave., Alhambra, CA
509 W. Norwood Pl., Alhambra, CA
120 S. Ynez Ave., Monterey Park, CA
400 Casuda Canyon Dr., Monterey Park, CA
1701 Brightwood St., Monterey Park, CA
650 Grandridge Ave., Monterey Park, CA

Here’s the link to my test server —
http://kronusproductions.com/mycarpaysme_ajax/test_street_view13.php

As you can see there are no errors reported in IE, Safari and FF, but Opera is a different ball game.

Some warnings in Safari for the svgs returned by google and some css warnings in FF, but 0 errors. IE complains when an address is not returned by google, but I will enter some kind of try and catch code for google after fixing this issue in Opera.

I have tried also sending the string to a function and return the evaluation, but nothing has worked so far.

Thanks in advance and I hope I have followed all the rules to posting to this forum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:57:20+00:00Added an answer on May 24, 2026 at 12:57 pm

    this

    for(index in myLat){
     markers[index].lat = myLat[index];
     markers[index].lng = myLng[index];
     markers[index].name = schoolNameArray[index];
    }
    

    should be

    for(var i=0;i<myLat.length;i++){
         markers.push({
            lat: myLat[i],
            lng: myLng[i],
            name: schoolNameArray[i]
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://maps.google.com/maps/geo ? web service to geocode some addresses. The problem I have
I am using Google Maps API for reverse lookup of an address, specifically Country,
I'm using Infostrat's WPF wrapper for the Bing maps 3d control (blog here http://blogs.msdn.com/virtualearth3d/
I'm using http://code.google.com/p/flex-iframe/ for showing html in an flex application. To set this up
I'm using http://code.google.com/p/flex-iframe/ for showing wikicontent in a flex app. <?xml version=1.0?> <mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml
I am using http://lite.facebook.com And i want to get some data from my account.
I am using Google maps JavaScript API. Here is code : <!DOCTYPE html PUBLIC
I am trying to do some basic geocoding using the google maps API and
I'm doing some geocoding using the google maps API. The user fill a form
I'm using the Google Maps API V3 and I'm trying to make a marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.