Google Maps API v3 - how to save map into cookie/localstorage - google-maps

I'm building a page which loads a google map, with street view on another div on the side and I would like to save that data so if the user closes his browser window and then comes back that it will bring it up again without the need to call the Google Map API again.
I've tried saving the div contents and replace it with the current one incase the user visited already.
I tried with cookies but couldn't save much information due for size limit of 4kb and I've tried localStorage (HTML5) but it didn't work as expected.
Any ideas?
Thanks

Related

Google map and Google Analytics on the same page, google map css, fonts are taking first place in the header

Google Map and Google Analytics on the same page, here I need to display the analytics code as the first one but automatically google map Css taking the first place in the header. how could load the analytics as first one in the header section?
also, google captcha taking the second place, please help me to sort out this problem
FYR I have attached the screenshot :
https://imgur.com/a/ZgXPBiz
You don't need to bother too much about that. Google Analytics is loaded on the pages asynchronously, meaning that you can't determine the location in the HTML code served to the visitor.
Also, GA loading a couple of lines below the opening is more than good enough and doesn't pose a threat or a big difference in the performance of the tracking because of it.

Inserting an iframe or Dynamic content into an info window?

I have a google map which is hooked up to a fusion table. Its pretty basic, lists street address, phone, and branch #.
I recently got a request though to add current weather to the info window that appears when a user clicks on a map marker.
Initially I thought I could just iframe this in, but it appears that google strips that HTML out of the info window when I add it in. I guess only basic html is allowed.
Does anyone know a way to throw dynamic content into that info window box or a way to get around google stripping out the iframe code?
The only iFrames I can get to work in fusion table map windows or cards are youtube embeds. Other iframes appear to get srtipped out as you say. It would be a good feature to be able to have universal iframe content instead of just google products.

Google maps - current location - no HTML5

I am using google maps on a simple HTML website. I can center the map on user's current location using HTML5, but that requires getting permission from the user.
Now, when I go to maps.google.com, the map is centered around my location pretty accurately, without asking my permission.
How can I do that? When I define the map in my HTML webpage, I need to identify the center. How can I set the center to the center that google maps automatically finds?
Thanks.
assuming your in chrome go to the google maps page, then press f12 goto the resources tab, expand local storage, session storage and cookies, delete all entries from there, close the tab, go back to maps, notice it will no longer have your location, you'll need to click on the sniper type gps icon and it will ask you in you browser if you want to allow location.
answer being it has to ask you for permission, there is no compromise whether it's google or anyone else.
Your only other option, if you are serving any content server-side, would be to attempt to get the user's location from his or her IP address. There are a handful of APIs and services out there that will give you approximate locations, but your mileage may vary greatly. And, as I mentioned, you would have to execute that code server-side and then return some lat-long back to the client side to initialize/update your map.

How to Show Driving Directions on New Google Maps via URL Link

I have a simple Google Maps link on my site that opens a new page and loads the driving directions from our location to customer's address.
The link is something like
https://maps.google.ca/maps?saddr=[our address]&daddr=[customer address]&dirflg=d
Where [our address] is replaced with our address and [customer address] is replaced by the customer address. The Google Maps is loaded properly with the directions drawn out on the map but is there a way to expand the "List all steps" for the default selected direction on page load?
I'm guessing Google Maps will automatically load the "best" route when the page is loaded but currently the user has to manually click on the "List all steps" to view the step by step directions. I want it so that when the user clicks the link on my site then it'll automatically load the map directions along with the step by step directions already opened. Is there some kind of special URL parameter that I can pass to do this?
I've been looking for the same solution - If you are able to format the link in the following way this works:
https://www.google.com/maps/dir/[customer address]/[our address]/am=t/
It would be good to figure out how to submit it from a standard HTML form though.

Has there been a change in Google maps for mobile?

I am having trouble getting Google Maps to work on my mobile website Here is my google maps direction page that i have been using for a while now. Here is the code in a txt file
The problem is that google maps doesn't show the route anymore but just the fronpage of google maps mobile.
Have there been some changes that i don't know about, this used to always work?
Thanks
Dave
make sure your form has a saddr and an eaddr fields (i have mine set to hidden) and change the form action just simply to "http://maps.google.com", no need for "m" or "directions", it'll just figure it all out now, which action it should take, based on the user agent I guess.
This will however, on mobile platforms, prompt an activity picker on android or launch google maps automatically on iPhone.
From what Im seeing at this point in the game, the onyl way around forcing anything is to write your own parser for the Google Directions API, using a combination of cURL and the json_decode function of PHP
:\ sadly