Skip to content Skip to sidebar Skip to footer

Opening A Dynamically Built Google Url In New Window

I'm using modified code originally supplied by Google to make a transit trip planner form that uses Google Maps. I'd like the results to open in a new window/tab so the user doesn'

Solution 1:

You can try using window.open instead. Here's a function that I created for opening child windows:

openChildWindowWithDimensions = function(url, width, height, showMenu, canResize, showScrollbars) {
    var childWindow = window.open(url, "", "\"width=" + width + ",height=" + height + ",menubar=" + (showMenu ? "1" : "0") + ",scrollbars=" + (showScrollbars ? "1" : "0") + ",resizable=" + (canResize ? "1" : "0") + "\"");
    if (childWindow){
        childWindow.resizeTo(width, height); //IE9 dimensions bug
    }
}

Add this function to your page, and at the end of your function that builds the URL, call it like this:

openChildWindowWithDimensions(loc, 800, 600, true, true, true);

Post a Comment for "Opening A Dynamically Built Google Url In New Window"