On 28 Apr 2007, at 13:51, Tomas Fischer wrote:> I want to load an external site A.html in an iframe. As far, no
> problem.
>
> But now, I want to load it with words hightlighted on it, like
> Google''s
> cache result pages. Unfortunately, the decision, which words should
> highlighted is done on run time.
>
> Is it possible to replace the original content with my content on the
> fly?
Yes, you can do that if you route the request/response through your
Rails app.
E.g. in your index action, make a Net::HTTP request to your external
site, gsub the response''s body to your heart''s content, then
send the
end result to the browser.
If you want the user to be able to navigate around the external site,
you''ll have to rewrite all the hyperlinks so that they point back to
your own action, with the real path stored in a param somewhere, so
your action can make another HTTP request to the appropriate part of
the external site, gsub the response''s body (including hyperlinks)
and send the result to the browser.
Regards,
Andy Stewart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---