Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Accessing an object in an iframe
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
DAZ  
View profile  
 More options Aug 11 2012, 2:14 pm
From: DAZ <daz4...@gmail.com>
Date: Sat, 11 Aug 2012 11:14:09 -0700 (PDT)
Local: Sat, Aug 11 2012 2:14 pm
Subject: Accessing an object in an iframe

Hi,

I have a Post object that I want to access on a page that also contains an
iframe. I also need to access the same post object from within the iframe.
Does anybody know if there's any way of doing this without having to access
the database again to find the post objec (like in the code below)t?

get '/:id' do
  @post = Post.get(params[:id])
  slim :show
end

get '/iframe/:id' do
  @post = Post.get(params[:id])
  slim :iframe
end

@@show
h1== @post.title
iframe src="/iframe...@post.id}"

@@iframe
== @post.body

cheers,

DAZ


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Rogers  
View profile  
 More options Aug 11 2012, 8:23 pm
From: Jason Rogers <jacaete...@gmail.com>
Date: Sat, 11 Aug 2012 20:23:05 -0400
Local: Sat, Aug 11 2012 8:23 pm
Subject: Re: Accessing an object in an iframe

I suppose you could serialize it as JSON in the session.

before do
  @post = session[:post] ? Post.new(JSON(session[:post]))
: Post.get(params[:id])
end

after do
  session[:post] = JSON(@post)
end

get '/:id' do
  slim :show
end

get '/iframe/:id' do
  slim :show
end

--

--
Jason Rogers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DAZ  
View profile  
 More options Aug 12 2012, 3:52 pm
From: DAZ <daz4...@gmail.com>
Date: Sun, 12 Aug 2012 12:52:17 -0700 (PDT)
Local: Sun, Aug 12 2012 3:52 pm
Subject: Re: Accessing an object in an iframe

Hi Jason,

Thanks for the reply. That's the only other idea I had of doing it (but I
hadn't thought of how to code it, so thanks :)

I guess using JSON would be good if I start updating the iframe with Ajax
later. I was hoping there might be another way of avoiding hitting the
database twice without having to use sessions and/or JSON, but I guess that
the iframe has to be loaded as a separate request.

Thanks again, cheers,

DAZ


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alper Akgün  
View profile  
 More options Aug 12 2012, 4:10 pm
From: Alper Akgün <alperak...@gmail.com>
Date: Mon, 13 Aug 2012 00:10:03 +0400
Local: Sun, Aug 12 2012 4:10 pm
Subject: Re: Accessing an object in an iframe

i suggest
- you consider communicating from parent to iframe; in js, with JSON which
is easier if you are the same domain
- or reconsider hitting database twice; not a big deal.
- or reconsider using iframes.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Eduardo L. Lopes  
View profile  
 More options Aug 13 2012, 9:56 am
From: "Carlos Eduardo L. Lopes" <carlos.el.lo...@gmail.com>
Date: Mon, 13 Aug 2012 10:56:01 -0300
Local: Mon, Aug 13 2012 9:56 am
Subject: Re: Accessing an object in an iframe

I agree with Alper's suggestions, and mainly the third: *reconsider using
iframes*.. but, if they are really necessary, you can use memcache to store
the response body.. so, you will store the response body in the memcache
when you do the first request, and retrieve the body from memcache when you
do the second request (iframe)

--
Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Rogers  
View profile  
 More options Aug 13 2012, 10:31 am
From: Jason Rogers <jacaete...@gmail.com>
Date: Mon, 13 Aug 2012 10:31:13 -0400
Local: Mon, Aug 13 2012 10:31 am
Subject: Re: Accessing an object in an iframe

I think that introducing Memcache for something like this is overkill. If
Memcache will be leveraged in some other way, that's another story.

On Monday, August 13, 2012, Carlos Eduardo L. Lopes wrote:

--

--
Jason Rogers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Eduardo L. Lopes  
View profile  
 More options Aug 13 2012, 10:39 am
From: "Carlos Eduardo L. Lopes" <carlos.el.lo...@gmail.com>
Date: Mon, 13 Aug 2012 11:39:28 -0300
Local: Mon, Aug 13 2012 10:39 am
Subject: Re: Accessing an object in an iframe

I agree with you too, but, store the response body inside a session like
Jason said is overkiil too, because it will consumes a lot of traffic,
decrease performance and other issues that we are now.. memcache is just an
option that works, but it's  true that it's too much for a too simple
thing..

--
Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Rogers  
View profile  
 More options Aug 13 2012, 2:04 pm
From: Jason Rogers <jacaete...@gmail.com>
Date: Mon, 13 Aug 2012 14:04:36 -0400
Local: Mon, Aug 13 2012 2:04 pm
Subject: Re: Accessing an object in an iframe

Interesting.

How does using the session consume a lot of traffic? You're going to make
the same amount of HTTP requests whether you use a session, memcache, or
hit the database every time. (You save yourself only one request if you
communicate between the iframe and parent window via JavaScript.) If the
size of the body is what you're concerned about, again it'll be the same if
you go back to the server despite what implementation you use on the
backend.

Don't optimize prematurely, optimization requires profiling.

--
Jason Rogers

On Mon, Aug 13, 2012 at 10:39 AM, Carlos Eduardo L. Lopes <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Eduardo L. Lopes  
View profile  
 More options Aug 13 2012, 2:23 pm
From: "Carlos Eduardo L. Lopes" <carlos.el.lo...@gmail.com>
Date: Mon, 13 Aug 2012 15:23:51 -0300
Local: Mon, Aug 13 2012 2:23 pm
Subject: Re: Accessing an object in an iframe

Yes, if you make only one request (parent), store the body inside a
session, and fill the iframe with the body that is already in the session,
i agree that this is the best option..

but i don't know if this works because i rarely work with iframes :/

--
Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Eduardo L. Lopes  
View profile  
 More options Aug 13 2012, 2:26 pm
From: "Carlos Eduardo L. Lopes" <carlos.el.lo...@gmail.com>
Date: Mon, 13 Aug 2012 15:26:28 -0300
Local: Mon, Aug 13 2012 2:26 pm
Subject: Re: Accessing an object in an iframe

And i was concerning about traffic because if do you have a large body,
make requests with a session that has a big size isn't good (imho, and in
my humble experience :) )

On Mon, Aug 13, 2012 at 3:23 PM, Carlos Eduardo L. Lopes <

--
Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Rogers  
View profile  
 More options Aug 13 2012, 3:30 pm
From: Jason Rogers <jacaete...@gmail.com>
Date: Mon, 13 Aug 2012 15:30:54 -0400
Local: Mon, Aug 13 2012 3:30 pm
Subject: Re: Accessing an object in an iframe

True. 2 requests for a large body can be time- and bandwidth-consuming. The
question becomes "what's too large?", which is where profiling is key.

--
Jason Rogers

On Mon, Aug 13, 2012 at 2:26 PM, Carlos Eduardo L. Lopes <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Eduardo L. Lopes  
View profile  
 More options Aug 13 2012, 3:40 pm
From: "Carlos Eduardo L. Lopes" <carlos.el.lo...@gmail.com>
Date: Mon, 13 Aug 2012 16:40:30 -0300
Local: Mon, Aug 13 2012 3:40 pm
Subject: Re: Accessing an object in an iframe

Sure! :)

--
Carlos Eduardo L. Lopes
Skype: carloslopespollares | Twitter: @_carloslopes

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »