Google Maps API gives me net::ERR_ABORTED 400
I have being trying to you the google maps api (Maps Javascript API). First I made a simple html file and made a simple map, it worked. Then I made a more complicated one with marks and polylines, it worked.
With this done I decided to move it into my web application, the thing is that my application works with xhtml, not html. Still it should work. But it is not the case.
I have read many forums, but I cannot seem to find the solution to my problem. Here is the simple map code that I tryied in an html file:
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>My Test</title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize">
</script>
</body>
Here is the same information but in my .xhtml file: (my xhtml is over a template that's why it does not have any of the head information.)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<p:dialog header="#{msg['MAP']}" footer="#{msg['TOURSYS.FOOTER.TITLE']} | #{msg['TOURSYS.FOOTER.VERSION']} | #{msg['TOURSYS.FOOTER.LAST.MODIFICATION.DATE']}" widgetVar="mapDialog" modal="true" height="auto" width="auto">
<h:form id="mapForm">
<html>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize;"/>
</body>
</html>
</h:form>
</p:dialog>
The following error is popping in my google console:
GET https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize; net::ERR_ABORTED 400
My application is running in a maven proyect with Primefaces 6.2.7
google-maps
add a comment |
I have being trying to you the google maps api (Maps Javascript API). First I made a simple html file and made a simple map, it worked. Then I made a more complicated one with marks and polylines, it worked.
With this done I decided to move it into my web application, the thing is that my application works with xhtml, not html. Still it should work. But it is not the case.
I have read many forums, but I cannot seem to find the solution to my problem. Here is the simple map code that I tryied in an html file:
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>My Test</title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize">
</script>
</body>
Here is the same information but in my .xhtml file: (my xhtml is over a template that's why it does not have any of the head information.)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<p:dialog header="#{msg['MAP']}" footer="#{msg['TOURSYS.FOOTER.TITLE']} | #{msg['TOURSYS.FOOTER.VERSION']} | #{msg['TOURSYS.FOOTER.LAST.MODIFICATION.DATE']}" widgetVar="mapDialog" modal="true" height="auto" width="auto">
<h:form id="mapForm">
<html>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize;"/>
</body>
</html>
</h:form>
</p:dialog>
The following error is popping in my google console:
GET https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize; net::ERR_ABORTED 400
My application is running in a maven proyect with Primefaces 6.2.7
google-maps
add a comment |
I have being trying to you the google maps api (Maps Javascript API). First I made a simple html file and made a simple map, it worked. Then I made a more complicated one with marks and polylines, it worked.
With this done I decided to move it into my web application, the thing is that my application works with xhtml, not html. Still it should work. But it is not the case.
I have read many forums, but I cannot seem to find the solution to my problem. Here is the simple map code that I tryied in an html file:
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>My Test</title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize">
</script>
</body>
Here is the same information but in my .xhtml file: (my xhtml is over a template that's why it does not have any of the head information.)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<p:dialog header="#{msg['MAP']}" footer="#{msg['TOURSYS.FOOTER.TITLE']} | #{msg['TOURSYS.FOOTER.VERSION']} | #{msg['TOURSYS.FOOTER.LAST.MODIFICATION.DATE']}" widgetVar="mapDialog" modal="true" height="auto" width="auto">
<h:form id="mapForm">
<html>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize;"/>
</body>
</html>
</h:form>
</p:dialog>
The following error is popping in my google console:
GET https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize; net::ERR_ABORTED 400
My application is running in a maven proyect with Primefaces 6.2.7
google-maps
I have being trying to you the google maps api (Maps Javascript API). First I made a simple html file and made a simple map, it worked. Then I made a more complicated one with marks and polylines, it worked.
With this done I decided to move it into my web application, the thing is that my application works with xhtml, not html. Still it should work. But it is not the case.
I have read many forums, but I cannot seem to find the solution to my problem. Here is the simple map code that I tryied in an html file:
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>My Test</title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize">
</script>
</body>
Here is the same information but in my .xhtml file: (my xhtml is over a template that's why it does not have any of the head information.)
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<p:dialog header="#{msg['MAP']}" footer="#{msg['TOURSYS.FOOTER.TITLE']} | #{msg['TOURSYS.FOOTER.VERSION']} | #{msg['TOURSYS.FOOTER.LAST.MODIFICATION.DATE']}" widgetVar="mapDialog" modal="true" height="auto" width="auto">
<h:form id="mapForm">
<html>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<body>
<div id="map"></div>
<script>
function initialize() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize;"/>
</body>
</html>
</h:form>
</p:dialog>
The following error is popping in my google console:
GET https://maps.googleapis.com/maps/api/js?key=MYAPI&callback=initialize; net::ERR_ABORTED 400
My application is running in a maven proyect with Primefaces 6.2.7
google-maps
google-maps
asked Dec 27 '18 at 21:56
Alice
61
61
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53951260%2fgoogle-maps-api-gives-me-neterr-aborted-400%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53951260%2fgoogle-maps-api-gives-me-neterr-aborted-400%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown