my application makes extensive use of the Google map and I would like to know how I can pass latitude and longitude information obtain from one page to the next. the function I like to access exist in a completely different web page located on our server.

The problem seems very straight forward but I don't know how to accomplish the task. However, I would appreciate anyone who can point me in the right direction.

Recommended Answers

All 13 Replies

1. open your new page window (make sure you save the window to a variable i.e. 'win')

var win = window.open(....);

2. from existing page check the new window youve opened to see if it is finished loading. If it has then call the function if not set timeout to try again

checkwin(){
    if(win.document.readyState == 'complete') {
        win.functionname(variable1, variable2);
    } else {
        settimeout('checkwin()', 1000);
    }
}
checkwin();

I am unclear about the first step. Is this implementation going to open a popup window or is it going to use the parent window? I have not tried it yet but it seems very simple.

the implementation i stated opens a popup and passes 2 values throught to a function located on that page. are you doing the opposite and trying to obtain two values from the parent of the current window ?

No, Your first assumption is correct; however, I was trying to avoid pop-up since most of our users don't know how to deal with pop-up especially if they have pop-up blocker enabled. I wanted to pass the value to the page while I opened it up like a normal web page.

Is the event which initiates the sending of information from one page to another user initiated? Do you want this to be done server side or client side?

If you want to do it server side, just set those values in hidden fields, extract those using the server side language of your choice and send the response page to the client with the given values set (here I am talking about J2EE servets). If you want to do it using Javascript, just set the href property of the location object. location.href = 'http://www.google.com?var1=' + var1 + '&var2=' + var2; Encode values if needed.

Yes. the event is user initiated. I figured when the user initiated the event, I can pass the lat and long value to the next page while loading and accessing the event.addlistener method of that page. what I would like to see happened is to have pass the arguments from the previous page to the next page and have the info window opened once its fully loaded (pretty much your first assumption).

I think the query string location.href.... would work well, however I don't see how I can automatically call the event.addlistener from that point.

Fungus1487 thank you for your assistance. I am going to implement the methods we discussed and I will let you know if any of them work for me. meanwhile, if you have any other suggestion, please post them on the thread.

i agree with SOS that if you wish to do this without opening a popup then simply append your values to the path of the page calling then add an onload event to that page that checks to see if these variables are set. If so then fire away on whatever you wish to do with this info.

I do agree with SOS in a lot of ways and that is why I was looking at using the query string. I am in the process of implementing the suggestions for a test. If any of them work, I will post the result.

Implementations which use pop-ups are anyways yucky. They break the rules of site usability and are a strong force in driving away your customers (if it is not an intranet website in which case this point is moot). Read this and this.

Hence you shouldn't think of pop-ups as a solution to any of your problems unless specifically mentioned by the client.

if were simply talking about web design then again i agree with SOS but for web application terms or other such i stand by the fact that popups can be incorporated to enrich a users experience.

What can be done by pop-ups can be gracefully implemented using 'div'. You just need to know how to do it.

And BTW, web design and web application development and two mutually exclusive entities. The proper application of one results in the successful development of another.

Happy Thanksgiving to all of you who have helped me out (now or in the pass).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.