views:

35

answers:

1

I've embedded Google Maps via an iframe in my website. I can't use the API at this point which is why I'm using the iframe.

Is there a way to scroll the iframe so that the upper part of the Google Maps page (search bar, etc.) are no longer visible to the user?

A: 

If the page was hosted in the same domain, you could use the scrollTop and scrollLeft dhtml properties on the iframe.document.body. However this is unlikely if you are hosting google maps from a remote server. You will be unable to modify the child frame contents via script.

Even if you could, this would always be a fragile solution. If the structure of the Google Maps changed at all, you would have to update your scrollTop/Left mechansim. Users will still be able to click in the frame and drag up to get the frame to scroll up, or even use the arrow keys.

Trying to fix the scroll position, then blocking the user from scrolling will likely be more trouble than it is worth.

ScrollTop Doc: http://msdn.microsoft.com/en-us/library/ms534618(v=VS.85).aspx

You should probably try to eliminate whatever hurdles exist to using the API.

David