Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

IFRAME -> Whole page

 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a page with three IFRAMES. When I submit a particular request from one of the IFRAMEs the response should be loaded into the whole of the page, not in the IFRAME which sent the request. During the time of sending, the IFRAME does'nt have any knowldege about where the response should be loaded. It will be determined at the server end (JSP).
How to achieve it? Any ways to specify the target from Server side?
Should this be a JSP question...? :roll:
thanks
sudharsan
 
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no way to change the target once the request has been initiated.
One trick you could try is, in the case where you want to hijack the response from the iframe to the parent, is to create a response that causes a redirect to the parent.
This will need to be carefully coded, means that there will be two requests initiated for the action, and there is lots of potential for bumps and warts, but it might get you the behavior you are looking for.
hth,
bear
[ March 12, 2003: Message edited by: Bear Bibeault ]
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

create a response that causes a redirect to the parent.


Mm. How do we achieve this?
 
Bear Bibeault
Sheriff
Posts: 67592
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are any number of ways depending upon how complicated the request needs to be, and whether you need to trigger a GET or a POST request.
What you are trying to do isn't a very standard or common way to do things. Perhaps sitting back and evaluating why you need to wait until the request has been submitted in order to determine its target would let you come up with a cleaner solution using more common practices.
That said, one fairly staight-forward way to do this would be to have the response generate an HTML page containing a form. The target of the form would be "_top" and the method set to get or post as approriate. The action would be set to whatever request you are trying to target to the whole page. If there are any request parameters, they can be put into the form as hidden fields.
Then, use an onload handler to cause the form to be submitted.
This results in a blank page being loaded into the iframe which triggers the subsequent request to the whole page.
Depending upon exactly what you are trying to do, there may be more elegant solutions. But, I reiterate, I think it'd be best to ponder your design and refactor if possible to where this is not necessary at all.
hth,
bear
[ March 13, 2003: Message edited by: Bear Bibeault ]
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup! You are right bear! This is not an elegant deseign for the web. Actually we are creating an equivalent implementation for an existing Application in VB. The back-end portion of it is event-based. When you click a button, you will not have control over the action it should take. That is dependent on the current state of the button. I will just pass 'Button1_clicked' and depending on the state, the back-end determines the current action for that button.
Am I clear in explaining my problem?
Your solution is good. I'm also thinking about an alternate solution. Instead of a proxy request, I will send another event which will interpreted as I need.
Thanks for ur suggestions bear!
rgds
Sudharsan
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another thing you can try:
the respond, that you send to iframe, should look like:
<script>
top.location.href="url to load into main window";
<script>
[ March 15, 2003: Message edited by: Yuriy Fuksenko ]
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic