0

http://sequoiapacificmortgage.com/loan-application/

I have embedded the clients' loan application form (on another website) into an iFrame so the user stays on the site. The loan application (upon submit) redirects to the client's Home Page, but unfortunately, it stays within the frame rather than going to the main Home Page window. I had inquired here about how to remedy this, and was told that the Target attribute target="_top" would do the trick.

The loan application processor people have no way to add the Target attribute to the redirect URL, and they have suggested the following:

"The thank you page after the application and before the redirect URL has a unique URL.

Is it possible to code your iframe to recognize this URL and redirect the full site to your home page rather than depending on the vLender redirect within the iframe?

I am including the unique thank you page URL from Lori's website below, the ref_ID attribute is the unique application ID number assigned to my test application (the application ID's are generated using the first 3 letters of the applicant's first name [LYN for Lynsee] and the first 3 letters of the applicant's last name [TES for Testing] followed by the numeric sequence) but you should be able to remove that and have your custom site's code recognize the .php url which would trigger a redirect within your site's code that would take place before our system enacts its redirect to the home page within the iframe.

(https://www.vlender.com/apps/templates/new_thank_you.php?ref_id=LYNTES998262971)"

Is it even possible to do this? Thanks for your advice!

regards, Ned

Nedward
  • 1
  • 1
  • 1

1 Answers1

0

EDIT: You could handle the navigation of the iframe, and see what url it goes to.

use onload to see when the iframe navigated to a new page, and contentWindow.location.href to get the url from the iframe.

something like:

function checkURL() {
    if(document.getElementById('iframeID').contentWindow.location.href == "UNIQUE_URL") // if the location of the iframe is the unique url
        window.location = "redirect.html"; //redirect this page somewhere else.
});
<iframe id="iframeID" onload="checkURL();" ... //onload fires when a page loads in the iframe

on load: http://w3schools.com/jsref/event_frame_onload.asp

get iframe URL: Get current URL from IFRAME

Community
  • 1
  • 1
TastySpaceApple
  • 3,115
  • 1
  • 18
  • 27
  • 2
    Welcome to SO! The OP didn't tag `jQuery` so you should try and answer in plain JS. – srquinn Dec 18 '13 at 19:12
  • Is this JS? Also, on the redirect, this needs to go to the Top outside of the iFrame, so how do I structure this? – Nedward Dec 18 '13 at 19:56
  • Edited, notice the changes. (everything...) Also, see the explanation and comments. for more information see the links. – TastySpaceApple Dec 18 '13 at 21:00
  • I changed window.location to window.top.location because it keeps loading within the frame. Also, it is not reloading before the application's redirect. – Nedward Dec 18 '13 at 22:36
  • This is going to kill it for me, yes??? Calling a parent JS function from iframe is possible, but only when both the parent and the page loaded in the iframe are from same domain i.e. abc.com, and both are using same protocol i.e. both are either on http:// or https://. The call will fail in below mentioned cases: Parent page and the iframe page are from different domain. They are using different protocols, one is on http:// and other is on https://. Any workaround to this restriction would be extremely insecure. – Nedward Dec 19 '13 at 00:35