The worklight hybrid app is not asking share your location. Without asking it is showing some other location. What can i do for this? Please tell me the solution.
This is my total code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Go2needs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
window.$ = window.jQuery = WLJQ;
function wlCommonInit() {
}
function getGeo() {
alert();
/* WL.Device.Geo.acquirePosition(positive, negative, {
enableHighAccuracy: true,
});
alert(); */
if (navigator.geolocation) {
alert('if');
navigator.geolocation.getCurrentPosition(function(position) {
//alert(position.coords.latitude);
//alert(position.coords.longitude);
var geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
geocoder.geocode({
'latLng': latlng
}, function(results, status) {
alert('geo');
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
console.log(results[1]);
alert(results[1].formatted_address);
}
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
});
alert('end');
}
}
/* function positive(data) {
alert();
alert(JSON.stringify(data));
}
function negativa(data) {
alert();
alert(JSON.stringify(data));
} */
</script>
</head>
<body onload="WL.Client.init({})">
<input type="button" value="Click" onclick="getGeo()" />
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
The way you are implementing this is very strange; it is as if you're following tutorials from Worklight 4.x or 5.x... very old.
Try this:
AndroidManifest.xml
Add required permissions:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
index.html
The head should be like this:
<head>
<meta charset="UTF-8">
<title>index</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<!-- <link rel="shortcut icon" href="images/favicon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png"> -->
<link rel="stylesheet" href="css/main.css">
<script>window.$ = window.jQuery = WLJQ;</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
</head>
And the body:
<body style="display: none;">
<h1>Googlel Maps - show my position</h1>
<div id="map-canvas"></div>
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
main.js:
var myLat;
var myLong;
function wlCommonInit(){
navigator.geolocation.getCurrentPosition(setPositionCoords, errorSettingCoords);
var mapOptions = {
center: new google.maps.LatLng(myLat, myLong),
zoom: 7,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(myLat, myLong),
map: map,
title:"Hey Me!"
});
}
function setPositionCoords(position) {
myLat = position.coords.latitude;
myLong = position.coords.longitude;
}
function errorSettingCoords() {
alert ("Failed setting coordinates.");
}
Related
I want to post data to the above link(in spite of using a webservice) using cordova and angularjs. I have used alerts in between to know which functions are working properly. sign Up Function is not working, it is entering the function but not entering the request method to post data.
Is there any error in request.success(function(data)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport"content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<meta name="msapplication-tap-highlight" content="no" />
<title>Post Data</title>
</head>
<body>
<div ng-app="HelloApp" ng-controller="HelloCtrl">
<form role="form" action="#">
<div>
Name: <input type="text" ng-model="name"><br>
Country: <input type="text" ng-model="country"><br>
Twitter: <input type="text" ng-model="twitter"><br>
<button ng-click="signUp()">Save</button><br>
<span>{{responseMessage}}</span>
</form>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script>
alert('Before controller');
var helloApp = angular.module("HelloApp", []);
helloApp.controller("HelloCtrl", [ '$scope','$http', function($scope,$http)
{
alert('Entered Controller');
$scope.name = "Calvin Hobbes";
$scope.country = "US";
$scope.twitter = "as#gmail.com";
$scope.signUp = function () {
/* $scope.Message = "Button clicked."*/
alert("Button CLicked");;
var request = $http({
method: "post",
dataType:'json',
url: "http://hmkcode.appspot.com/jsonservlet",
crossDomain : true,
data: {
'name': $scope.name,
'country': $scope.country,
'twitter': $scope.twitter
},
headers: { 'Accept':' text/plain','Content-Type': 'textjson' }
});
/* Successful HTTP post request or not */
request.success(function(data) {
alert("success function");
if(data == "1"){
$scope.responseMessage = "Successfull";
}
if(data == "2"){
$scope.responseMessage = "failed";
} else if(data == "0") {
$scope.responseMessage = "Error";
}
});
}
}]);
</script>
</body>
</html>
How can i post the data to the webservice(http://hmkcode.appspot.com/jsonservlet)
You have to change your controller the following way. Since you are using the new version of angularjs, change .success to .then. And also when you are using form, it is better to use ng-submit
JS:
$scope.signUp = function () {
/* $scope.Message = "Button clicked."*/
alert("Button CLicked");;
var request = $http({
method: "post",
dataType:'json',
url: "http://hmkcode.appspot.com/jsonservlet",
crossDomain : true,
data: {
'name': $scope.name,
'country': $scope.country,
'twitter': $scope.twitter
},
headers: { 'Accept':' text/plain','Content-Type': 'application/json' }
});
/* Successful HTTP post request or not */
request.then(function(data) {
alert("success function");
if(data.data == "1"){
$scope.responseMessage = "Successfull";
}
if(data.data == "2"){
$scope.responseMessage = "failed";
} else if(data.data == "0") {
$scope.responseMessage = "Error";
}
});
}
HTML:
<form role="form" ng-submit="signUp()">
<div>
Name: <input type="text" ng-model="name"><br>
Country: <input type="text" ng-model="country"><br>
Twitter: <input type="text" ng-model="twitter"><br>
<button type="submit">Save</button><br>
<span>{{responseMessage}}</span>
</form>
I am trying to make a Anroid Mobile Application to Save Data to a Remote SQL Database. I am using Cordova Project in Visual Studio 2015. I have a Webservice which is working fine and taking Name, Phone & Profile information and saving data in SQL Server properly. Now I am trying to call this WebService from Android Mobile Application but $Ajax Call to webservice is not working. The control is not reaching to the Webservice.
I have already added WhiteSpace Plugin but its still not working.
Here is the original html file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script src="../scripts/jquery-3.1.0.min.js"></script>
<script src="../scripts/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); }
function onDeviceReady() { alert("Device is Ready to User"); }
function SaveContact() {
var Contact = new Object();
Contact.Name = "Harvinder";
Contact.Phone = "9819862717";
Contact.Profile = "Director"
var myData = JSON.stringify(Contact);
var myURL = "http://gsecurity.net/JsonDAL.asmx/SaveContact";
alert(typeof (myData));
$.ajax({
type: "POST", url: myURL, data: myData, contentType: "application/json; charset=utf-8", dataType: "json",
success: function (msg) { alert("Success"); },
error: function (e, status) { alert("Failed:" + e.statusText); }
});}
</script>
</head>
<body onload="onLoad()">
<h1>Call Ajax to Save Json Data with WebService</h1>
<button onclick="SaveContact();">Click Here to Save Test Contact</button>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/appBundle.js"></script>
</body>
</html>
Here is the modified code as per suggestions which is still not working
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() { alert("Version 1.10 is Ready"); }
$.support.ajax = true;
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
function SaveContact() {
var Contact = new Object();
Contact.Name = "Harvinder";
Contact.Phone = "9819862717";
Contact.Profile = "Director";
var myData = JSON.stringify(Contact);
var myURL = "http://gsecurity.net/JsonDAL.asmx/SaveContact";
alert("DataType:" + typeof (myData));
$.ajax({
type: "POST", contentType: "application/json", dataType: "json",
url: myURL, data: myData, allowCrossDomainPages: true,
success: function (msg) { alert("Success"); },
error: function (e, status) { alert("Failed:" + e.statusText); }
});
alert("Completed");
}
</script>
</head>
<body>
<h2>Call Ajax to Save Json Data with WebService</h2>
<button onclick="SaveContact()">Click Here to Save Test Contact</button>
<script type="text/javascript" src="../scripts/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="../scripts/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/appBundle.js"></script>
</body>
</html>
My Webservice is Here which is working fine when accessed directly by url
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
<System.Web.Script.Services.ScriptService()>
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")>
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<ToolboxItem(False)>
Public Class JsonDAL
Inherits System.Web.Services.WebService
<WebMethod>
Public Function SaveContact(Name As String, Phone As String, Profile As String) As String
Try
Dim ConStr = ConfigurationManager.ConnectionStrings("Data").ConnectionString
Dim Con = New SqlConnection(ConStr)
Dim Qry = "INSERT INTO Contacts (Name,Phone,Profile) VALUES ('" + Name + "','" + Phone + "','" + Profile + "')"
Dim Cmd = New SqlCommand(Qry, Con)
Cmd.CommandType = CommandType.Text
Con.Open()
Cmd.ExecuteNonQuery()
Con.Close()
Return "Done"
Catch ex As Exception
Return ex.Message
End Try
End Function
End Class
There are many mistakes in your code.You don't need to add deviceReady event OnLoad event etc etc. I modified your code try this.Check your database I added one record name="TestFromHomen"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script src="../scripts/jquery-3.1.0.min.js"></script>
<script src="../scripts/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("Device is Ready to User");
}
function SaveContact() {
var Contact = new Object();
Contact.Name = "Harvinder";
Contact.Phone = "9819862717";
Contact.Profile = "Director"
var myData = JSON.stringify(Contact);
var myURL = "http://gsecurity.net/JsonDAL.asmx/SaveContact";
alert(typeof (myData));
$.ajax({
type: "POST",
url: myURL,
data: myData,
contentType: "application/json",
dataType: "json",
success: function (msg) { alert("Success"); },
error: function (e, status) { alert("Failed:" + e.statusText); }
});
}
</script>
</head>
<body>
<h1>Call Ajax to Save Json Data with WebService</h1>
<button onclick="SaveContact()">Click Here to Save Test Contact</button>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/appBundle.js"></script>
</body>
</html>
I have a problem with this code. I can see the Google Maps correctly, with my actual location in the center of the android screen, but I cannot see the marker whatever I do.
This is the html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<style>
html, body {
height:100%;
}
</style>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter" ng-controller="GeoCtrl" class="platform-android">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
This is the services.js
angular.module('starter.services', [])
.factory('Location', ['$q', function($q) {
return {
getLocation: function(options) {
var q = $q.defer();
navigator.geolocation.getCurrentPosition(function(position) {
q.resolve(position);
}, function(err) {
q.reject(err);
});
return q.promise;
}
}
}]);
And this is the app.js:
angular.module('starter', ['ionic', 'starter.services'])
.run(function($ionicPlatform) {
...
})
.controller('GeoCtrl', function($scope, Location) {
$scope.lat;
$scope.long;
$scope.map;
$scope.marker;
Location.getLocation().then(function (position) {
$scope.lat = position.coords.latitude;
$scope.long = position.coords.longitude;
var mapOptions = {
center: new google.maps.LatLng($scope.lat, $scope.long),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
$scope.map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
}, function(err) {
// error
});
$scope.marker = new google.maps.Marker({
position: new google.maps.LatLng($scope.lat, $scope.long),
map: $scope.map,
title: 'Holas!'
}, function(err) {
console.err(err);
});
});
Thank you!
I hope this can help to somebody:
I called the marker outside the then flow, whereas it has to be called inside:
Location.getLocation().then(function (position) {
$scope.lat = position.coords.latitude;
$scope.long = position.coords.longitude;
var mapOptions = {
center: new google.maps.LatLng($scope.lat, $scope.long),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
$scope.map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
$scope.marker = new google.maps.Marker({
position: new google.maps.LatLng($scope.lat, $scope.long),
map: $scope.map,
title: 'Holas!'
}, function(err) {
console.err(err);
});
}, function(err) {
// error
});
Now it works.
I am trying to develope an app using angular.js and phonegap. My problem is that I have set everything good in my router, but still new views are not loading, so in order to change the view after the route is changed you need to refresh.
Here is my index.html file
<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org" lang="en" ng-app="myApp">
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
<!-- Use the .min version of bootstrap files in production -->
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<title>Angular PhoneGap Sample</title>
</head>
<body>
<!-- The following tag is in place of ng-view to use the angular mobile view navigation framework
https://github.com/ajoslin/angular-mobile-nav
-->
<mobile-view/>
<!-- Comment out the following 2 lines to test on the browser-->
<script type="text/javascript" src="cordova-2.7.0.js"></script>
<script src="lib/index.js"></script>
<!-- In production use min versions -->
<script src="lib/jx.min.js"></script>
<script src="lib/angular.js"></script>
<script src="lib/angular-mobile.js"></script>
<script src="lib/mobile-nav.js"></script>
<script src="lib/jquery.min.js"></script>
<!-- // <script src="lib/angular-route.min.js"></script>
// <script src="lib/angular-resource.js"></script>
// <script src="lib/ui-bootstrap-tpls-0.11.0.min.js"></script> -->
<script src="app/app.js"></script>
<script src="app/main/mainController.js"></script>
<script src="app/about/aboutController.js"></script>
<script src="app/about/playController.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
And here is the app.js
'use strict';
function jsonp_callback(data) {
// returning from async callbacks is (generally) meaningless
console.log(data.found);
}
var myApp = angular.module('myApp', ['ajoslin.mobile-navigate', 'ngMobile']);
myApp.config(function ($compileProvider){
$compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/);
})
myApp.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
})
.when('/play', {
templateUrl: 'app/play/play.html',
controller: 'PlayCtrl'
})
.when('/settings', {
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
})
.when('/options', {
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'app/about/about.html',
controller: 'AboutCtrl'
})
.otherwise({
redirectTo: '/'
});
}]);
myApp.run(function($rootScope, $location){
// $rootScope.$on('$routeChangeError', function(event, current, previous, rejection){
// if(rejection === 'not-authorized'){
// $location.path('/');
// }
// if(rejection == 'authorized'){
// $location.path('/home');
// }
// });
var history = [];
$rootScope.$on('$routeChangeSuccess', function() {
history.push($location.$$path);
});
$rootScope.history = history;
});
And I tried to change route both with a hyperlink href="#/play" and within the controller$location.path('/play');` but nothing works ;/
I think, nothing will work until you inject ngRoute. You have to add that file too in Index.html.
angular-route.js is now separate file. You manually have to inject that file in order to run your defined routes.
One more thing with 'a' html link tag you have to write href="#play"...
I'm not sure about mobile-view. so use ng-view if it doesnt work.
At the end I was able to get it running with angular-mobile, ngRoute, and no hrefs. Instead of them I used this function on ng-click:
$scope.slidePage = function (path,type) {
navSvc.slidePage(path,type);
};
with this service, of course:
myApp.factory('navSvc', function($navigate) {
return {
slidePage: function (path,type) {
$navigate.go(path,type);
},
back: function () {
$navigate.back();
}
}
});
I am Designing a mobile app on phonegap. In this I am trying to get curent location of user. But I am not getting the map on Andriod Emulator.
I used this code :
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap Map</title>
<link rel="stylesheet" href="/master.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError,{alert("error"),"enableHighAccuracy":true,"timeout":3000});
}
//GEOLOCATION
var onSuccess = function(position) {
alert("Latitude: " + position.coords.latitude + "\n" +
"Longitude:" + position.coords.longitude + "\n");
var myLat = position.coords.latitude;
var myLong = position.coords.longitude;
//MAP
var mapOptions = {
center: new google.maps.LatLng(myLat, myLong),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert("code: " + error.code + "\n" +
"message: " + error.message + "\n");
}
</script>
</head>
<body onload="onLoad()">
<div>map</div>
<div id="map_canvas" style="width:100px; height: 100px;" ></div>
</body>
</html>
I don't know where I am gng wrong.Can any one please help me on this?
Check this code... change cordova-1.8.1.js into ur cordova2.0.js... remaining source is refer thro online. If its not works. then there problem in ur phonegap configuration.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Info Window Simple</title>
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" charset ="utf-8" src="cordova-1.8.1.js"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+
'<div id="bodyContent">'+
'<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
'sandstone rock formation in the southern part of the '+
'Northern Territory, central Australia. It lies 335 km (208 mi) '+
'south west of the nearest large town, Alice Springs; 450 km '+
'(280 mi) by road. Kata Tjuta and Uluru are the two major '+
'features of the Uluru - Kata Tjuta National Park. Uluru is '+
'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
'Aboriginal people of the area. It has many springs, waterholes, '+
'rock caves and ancient paintings. Uluru is listed as a World '+
'Heritage Site.</p>'+
'<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
'http://en.wikipedia.org/w/index.php?title=Uluru</a> '+
'(last visited June 22, 2009).</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Uluru (Ayers Rock)'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>