PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 15, 2022

[FIXED] How to submit a form from inside an iframe and have result be outside

 April 15, 2022     forms, iframe, javascript, post     No comments   

Issue

I have been trying to have a small login widget that I embed within a static page inside an iframe allow someone to log into my site. The problem I get is that when the form posts it ends up appearing inside the iframe instead of as a full browser page.

I know it is possible to do this because https://www.salliemae.com/ employs the same strategy on their home page. They embed an iframe inside their static page that does all their logic for them. I have very similar javascript in that I call form.submit() when someone clicks. The only difference is that I use jQuery to catch the click event vs putting the onclick directly on the form element.

I have looked at their code in their calm.js and it seems to be doing a simple form.submit() as I do, but their page loads fully in the browser vs only in the iframe. I have looked around SO and not seen a similar post, so if I just missed it, please let me know.


Solution

See target="_top" in the iframe's <form> tag. That tells the browser to load the response in the parent frame.



Answered By - Hamish
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing