Is there a way to pass a parameter from outside a Frame to something
running inside a Frame? Query parameters on the frame creation url do
not work.
The fact that they are two projects is just a convenience to me, so
that I can break up a larger item into smaller items. On the menu of
the homesite project, there is an entry to view races, which causes
the second url to be loaded into a frame of the first one. There are
also entries to view training runs or a comparison between gps
devices.
On the second url mentioned above I could type:
http://www.netrocam.com/runviewer/RunViewer.html?runType=training or ?
runType=comparison. (There is also runType=races, but that is the
default). These request parameters work fine when executed from the
second url. But, when I attempt to pass them from the first
application with
String pageURL = "http://www.netrocam.com/runviewer/RunViewer.html?
runType=training"
Frame bodyFrame = new Frame(pageURL);
The request parameter seems not to be passed to the second
application. In the second application I am attempting to get the
parameter by calling the following:
public native String getQueryString()/*-{
return window.top.location.search.toString();
}-*/;
but this returns an empty string.
I don't know of any other way to pass values from the first
application to the second one without goint to LOTS of trouble, like
uploading the request to a database and then checking the database
when the second application is launched, etc.
I would be grateful for any ideas.
>> I would be grateful for any ideas.
off: I think others would be greatful if you don't start new thread
for the same topic because you think you haven't received satisfactory
answer in your other two threads. Simply add new entry to your other
threads instead of starting new one,
I again tested your issue and I'm able to pass url+params to iframe
(tested in IE/FF/Safari windows) though frame content behavior
differes due to different domain policy (I've tested from running on
localhost),:
package com.mycompany.project.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestIFrame implements EntryPoint {
private Button clickMeButton;
public void onModuleLoad() {
final RootPanel rootPanel = RootPanel.get();
clickMeButton = new Button();
rootPanel.add(clickMeButton);
clickMeButton.setText("Click me!");
clickMeButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
rootPanel.remove(clickMeButton);
Frame iFrame = new Frame() {
public void onBrowserEvent(Event event) {
if (DOM.eventGetType(event) == Event.ONLOAD) {
Window.alert("url: " + this.getUrl());
}
super.onBrowserEvent(event);
}
};
rootPanel.add(iFrame);
iFrame.sinkEvents(Event.ONLOAD);
iFrame.setSize("100%", "100%");
String url = "http://www.netrocam.com/runviewer/RunViewer.html?
runType=training";
iFrame.setUrl(url);
}
});
}
}
here is content of your frame taken from Safari:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-
microsoft-com:vml">
<head>
<title>RunViewer</title>
<meta name='gwt:module' content='RunViewer'>
<link rel="stylesheet" href="RunViewer.css">
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script type="text/javascript"
src="http://maps.google.com/maps?
file=api&v=2.x&key=ABQIAAAA3pDFjGXx0dUPlqOV5wUzbhTGcmFu162Gy9wprnCT-
UoaWa9H0xTo9IuQLf9brY_iF2G2ffEjqGZf0A">
</script>
</head>
<body>
<script language="javascript" src="gwt.js"></script>
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></
iframe>
</body>
</html>
now I wonder what are your results? maybe your script is not loading
or something into your frame?
regards,
Peter
On Oct 4, 4:13 pm, rvd <r...@netrocam.com> wrote:
> I have two projects. One ishttp://www.netrocam.com/homesite/Homesite.html
> and one ishttp://www.netrocam.com/runviewer/RunViewer.html.
>
> The fact that they are two projects is just a convenience to me, so
> that I can break up a larger item into smaller items. On the menu of
> the homesite project, there is an entry to view races, which causes
> the second url to be loaded into a frame of the first one. There are
> also entries to view training runs or a comparison between gps
> devices.
>
> On the second url mentioned above I could type:http://www.netrocam.com/runviewer/RunViewer.html?runType=trainingor ?
If one executes http://www.netrocam.com/runviewer/RunViewer.html?runType=training
one can see "?runType=training" concatenated onto the end of the text
in the large text list box. This is just a test. However, if one
executes http://www.netrocam.com/homesite/Homesite.html and then
selects Running Stuff/View Training Courses that same parameter is
passed, but is not received at the destination. The application does
appear in the frame, and acts correctly. The only problem is that the
request parameter seems not to be retrievable. Perhaps it is because
it is associated with a frame that the destination does not know
about. I currently put up a Window.alert of the getUrl() just after
the setUrl. The Window alert does display the url, but the url still
is not accessible at the destination.
Unfortunately, I cannot test this locally because I get the error:
"[ERROR] Unable to find 'runviewer.gwt.xml' on your classpath; could
be a typo, or maybe you forgot to include a classpath entry for
source?"
So, I have to deploy to test.
regards,
Rich
also try passing params via Form submission with hidden field, maybe
that will work fine:
package com.mycompany.project.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.NamedFrame;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestIFrame implements EntryPoint {
private Button clickMeButton;
public void onModuleLoad() {
final RootPanel rootPanel = RootPanel.get();
clickMeButton = new Button();
rootPanel.add(clickMeButton);
clickMeButton.setText("Click me!");
clickMeButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
rootPanel.remove(clickMeButton);
NamedFrame iFrame = new NamedFrame("viewFrame");
rootPanel.add(iFrame);
iFrame.setSize("100%", "100%");
FormPanel f = new FormPanel(iFrame);
f.setAction("http://www.netrocam.com/runviewer/RunViewer.html");
f.setEncoding(FormPanel.ENCODING_URLENCODED);
f.setMethod(FormPanel.METHOD_GET);
Hidden h = new Hidden();
h.setName("runType");
h.setValue("training");
f.add(h);
f.setVisible(false);
rootPanel.add(f);
f.submit();
}
});
}
}
regards,
peter
On Oct 5, 1:18 am, Rich <RVDown...@gmail.com> wrote:
> Clearly one can do a setUrl followed by a getURl and retrieve the
> url. However, unfortunately, that is not the problem as described, in
> which the issue is passing the query parameter across applications.
> One does not have a "getUrl()" method available in the destination
> application, because the destination application does not know about a
> frame.
>
> If one executeshttp://www.netrocam.com/runviewer/RunViewer.html?runType=training
> one can see "?runType=training" concatenated onto the end of the text
> in the large text list box. This is just a test. However, if one
> executeshttp://www.netrocam.com/homesite/Homesite.htmland then
Regards,
Rich
regards,
Peeter
How does the destination application access the iframe? Isn't the
iframe outside of its "universe?"
It is good that they are passed to the iframe. Unfortunately, the
destination application doesn't know anything about the iframe. The
iframe is outside its "universe." If the destination application could
access the iframe, then the simple getUrl() would work.
I think all the difficulties are caused by the inability of the
destination application to access the iframe, and also that the
request parameters are not passed to the destination application as
part of the url with the setUrl or the Frame constructor.
I'm beginning to think that you just "can't get there from here."
Regards,
Rich