Is there a way to control elements inside a frame?

by skyvia
2 replies
  • WEB DESIGN
  • |
I have a site that I'm working on that is using a lightbox. The lightbox opens up a page to an e-commerce script that I bought which is a hosted solution (not on my server). I have no control of the source code on the page that I'm loading in the lightbox but I'm running into a problem.

When you submit the form in the lightbox, the results come back replacing the parent (whole page). Therefore the lightbox is gone and the user is actually on the other site which is nothing but the results.

I examined the code inside the page that I was loading within the lightbox and I think the problem is that there is a target="_top" element when defining the form:

<form action=resultspackage.cgi name=frm method=post target="_top">

Is there a way (maybe with javascript) to remove that target="_top" so that the results will come back in the lightbox instead of a new page?
#control #elements #frame #inside
  • Profile picture of the author 4under
    Usually if it's an iFrame pulling information from another site, you're not going to have any control. At least that's been my experience.

    I've built plugins that using iframe and there's simply no way to change what comes through unless it's on your servers.

    Darren

    Originally Posted by skyvia View Post

    I have a site that I'm working on that is using a lightbox. The lightbox opens up a page to an e-commerce script that I bought which is a hosted solution (not on my server). I have no control of the source code on the page that I'm loading in the lightbox but I'm running into a problem.

    When you submit the form in the lightbox, the results come back replacing the parent (whole page). Therefore the lightbox is gone and the user is actually on the other site which is nothing but the results.

    I examined the code inside the page that I was loading within the lightbox and I think the problem is that there is a target="_top" element when defining the form:

    <form action=resultspackage.cgi name=frm method=post target="_top">

    Is there a way (maybe with javascript) to remove that target="_top" so that the results will come back in the lightbox instead of a new page?
    {{ DiscussionBoard.errors[4381174].message }}
  • Profile picture of the author Cwantwm
    As 4under said above its impossible to modify iframe content...

    One method you 'could' use is, load the iframe content via PHP (CURL or similar), then do a string replace to remove the target="_top" and serve that modified content to the lightbox.
    {{ DiscussionBoard.errors[4391181].message }}

Trending Topics