What I want: I get a normal http request containing a URL from a remote server. Instead of redirecting to that URL, I want to load it into an iframe on an existing page. I''ve tried a number of approaches with no success. Can anybody suggest a good way to do this? Alternatively, if you can say "this is bloody impossible, because....", that would be helpful, too. --Al Evans -- Posted via http://www.ruby-forum.com/.
Al Evans wrote:> What I want: I get a normal http request containing a URL from a remote > server. > > Instead of redirecting to that URL, I want to load it into an iframe on > an existing page. > > I''ve tried a number of approaches with no success. > > Can anybody suggest a good way to do this? Alternatively, if you can say > "this is bloody impossible, because....", that would be helpful, too. > > --Al EvansAre you talking about a Websphere IFRAME? Or just using that terminology. I am not being able to understand what you mean by "want to load it into an iframe on an existing page". Please give details. aj -- Posted via http://www.ruby-forum.com/.
On 7/20/06, Ajaya Agrawalla <r6dude@gmail.com> wrote:> > What I want: I get a normal http request containing a URL from a remote > > server.in "I get" are you the browser or server?
If you receive a request to <http://example.com/display/ remoteserver.com/remote page> then you can use: map.connect ''display/:remote_url'', :controller => ''display'', :action => ''index'' And in the rhtml do something like: <div class="feature"> <div class="iframe"><iframe src="http://# {params[:remote_url]}" height=425 width=480>This is supposed to embed this <a href="#{params[:remote_url]}">remote page</a>.</iframe></div> In reality, you''d want a function in the controller to make sure that the remote url is legal. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 20, 2006, at 3:48 PM, Al Evans wrote:> What I want: I get a normal http request containing a URL from a > remote > server. > > Instead of redirecting to that URL, I want to load it into an > iframe on > an existing page. > > I''ve tried a number of approaches with no success. > > Can anybody suggest a good way to do this? Alternatively, if you > can say > "this is bloody impossible, because....", that would be helpful, too. > > --Al Evans > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
You might find http://javathehutt.blogspot.com/2006/07/rails-realities-part-15-ajax-modal.htmlvery useful. On 7/21/06, Dan Kohn <dan@dankohn.com> wrote:> > If you receive a request to <http://example.com/display/ > remoteserver.com/remote page> > > then you can use: > > map.connect ''display/:remote_url'', :controller => > ''display'', :action => ''index'' > > And in the rhtml do something like: > > <div class="feature"> <div class="iframe"><iframe src="http://# > {params[:remote_url]}" > height=425 width=480>This is supposed to embed this > <a href="#{params[:remote_url]}">remote page</a>.</iframe></div> > > In reality, you''d want a function in the controller to make sure that > the remote url is legal. > > - dan > -- > Dan Kohn <mailto:dan@dankohn.com> > <http://www.dankohn.com/> <tel:+1-415-233-1000> > > > > On Jul 20, 2006, at 3:48 PM, Al Evans wrote: > > > What I want: I get a normal http request containing a URL from a > > remote > > server. > > > > Instead of redirecting to that URL, I want to load it into an > > iframe on > > an existing page. > > > > I''ve tried a number of approaches with no success. > > > > Can anybody suggest a good way to do this? Alternatively, if you > > can say > > "this is bloody impossible, because....", that would be helpful, too. > > > > --Al Evans > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- rm -rf / 2>/dev/null - http://null.in "Things do not happen. Things are made to happen." - JFK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060721/42d9a0ad/attachment.html
Dan Kohn wrote:> If you receive a request to <http://example.com/display/ > remoteserver.com/remote page> > > then you can use: > > map.connect ''display/:remote_url'', :controller => > ''display'', :action => ''index'' > > And in the rhtml do something like: > > <div class="feature"> <div class="iframe"><iframe src="http://# > {params[:remote_url]}" > height=425 width=480>This is supposed to embed this > <a href="#{params[:remote_url]}">remote page</a>.</iframe></div> > > In reality, you''d want a function in the controller to make sure that > the remote url is legal.Thanks, that works, as far as it goes. But I don''t seem to have been quite clear on what I''m trying to do. Here''s the sequence: 1) The user fills in a form and submits it. 2) The app processes the data from that form, and a URL is built. 3) The app does a redirect to that URL. 4) The remote server send back a normal http request. The parameters may signify correct completion, failure, or a need for more data from the user. 5) If the remote system needs more data, it sends along a URL for a form in which the user can provide that data. After he has done so, goto step 4. I am trying to make this look seamless, by handling the remote server''s request for more data in an iframe. But so far, I haven''t been able to master the flow of control, and keep everything happening on one (RJS updated) page. In particular, I can''t figure out how to respond with an RJS update when the remote server sends a normal http request. I''m beginning to think I''m going about it all wrong, and it''s time for some serious redesign. I have no control over the remote server or its actions. --Al Evans -- Posted via http://www.ruby-forum.com/.
There may be some level of Javascript magic to do what you want, but I believe you are making this far harder than it should be. Fundamentally, the web architecture was not designed to allow a client to have asynchronous communications with two servers simultaneously. My first choice would be to simply redirect the user to the remote server, and have them redirect them back to my server when they''re done. This is, for example, how PayPal works. If that''s unacceptable, I would consider having your server act as a proxy between the client and the remote server. So, you pass through the clients request to the remote server, and then parse that remote server''s response and present it to the client. You can make everything AJAXy for the user, but our server has direct control over both sides. In 4, I assume you meant to say: "The remote server send back a normal http response." You''d need to be more specific if you want extra help. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 21, 2006, at 2:27 PM, Al Evans wrote:> Dan Kohn wrote: >> If you receive a request to <http://example.com/display/ >> remoteserver.com/remote page> >> >> then you can use: >> >> map.connect ''display/:remote_url'', :controller => >> ''display'', :action => ''index'' >> >> And in the rhtml do something like: >> >> <div class="feature"> <div class="iframe"><iframe src="http://# >> {params[:remote_url]}" >> height=425 width=480>This is supposed to embed this >> <a href="#{params[:remote_url]}">remote page</a>.</iframe></div> >> >> In reality, you''d want a function in the controller to make sure that >> the remote url is legal. > > Thanks, that works, as far as it goes. But I don''t seem to have been > quite clear on what I''m trying to do. Here''s the sequence: > > 1) The user fills in a form and submits it. > > 2) The app processes the data from that form, and a URL is built. > > 3) The app does a redirect to that URL. > > 4) The remote server send back a normal http request. The > parameters may > signify correct completion, failure, or a need for more data from the > user. > > 5) If the remote system needs more data, it sends along a URL for a > form > in which the user can provide that data. After he has done so, goto > step > 4. > > I am trying to make this look seamless, by handling the remote > server''s > request for more data in an iframe. But so far, I haven''t been able to > master the flow of control, and keep everything happening on one (RJS > updated) page. In particular, I can''t figure out how to respond > with an > RJS update when the remote server sends a normal http request. > > I''m beginning to think I''m going about it all wrong, and it''s time for > some serious redesign. I have no control over the remote server or its > actions. > > --Al Evans > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Dan Kohn wrote:> There may be some level of Javascript magic to do what you want, but > I believe you are making this far harder than it should be. > Fundamentally, the web architecture was not designed to allow a > client to have asynchronous communications with two servers > simultaneously.You''re right. I can do it with Javascript, or by doing some ugly major surgery on ActionController, but I haven''t found any other way.> My first choice would be to simply redirect the user to the remote > server, and have them redirect them back to my server when they''re > done. This is, for example, how PayPal works.That''s my current plan. All I have to do is figure out how to make it *look* seamless.> In 4, I assume you meant to say: "The remote server send back a > normal http response."No, actually, it''s a normal GET. That''s the problem:-) --Al Evans -- Posted via http://www.ruby-forum.com/.