November 13th, 2012, 08:47 AM
Link in iframe to open in a new window in an iframe, but still on my page.
I will explain it a bit.
mysite.com has an iframe with some links in it.
When you click a link in that iframe, it will open in the same iframe in mysite.com. This is not good, since I want one specific link in the iframe to open in a new window.
Not only do I want this link to open in a new window, but the new window has to be a page of my own site, with an iframe which displays the result of the clicked linked of the iframe on my homepage.
Hope you understand this, it's difficult to explain.
I am not familiar with jquery but i've searched and found something that I thought may help me a little. This is the closest topic on the web that i could find:
I've tried the basic codes listed there to start, but i don't even know how to implement that correctly on my pages. For instance, i tried this to start:
On my index.php:
As it says in the stackoverflow link i provided, but this doesn't work.
<iframe src="<?php echo $_GET['link']; ?>" />
Here is my testpage.
If you select a flight and click 'zoeken' (which means 'search') - then it has to open the /result.php page, with an iframe which excutes the search.
November 13th, 2012, 10:48 AM
Tried another way to get a bit of a start.
This method works for everyone in this thread:
But leaves me with a blank iframe on the new page.
Confusion is complete right now.
November 13th, 2012, 09:00 PM
If you have a link inside an iframe and you want it to open in the parent window instead of in the iframe, you can do so by specifying the target attribute in the HTML a tag for the link:
<a href="#" target="_parent">link</a>
If you want it to open in a new window, set the target to _blank.
<a href="#" target="_top">link</a>
Your approach with result.php is correct; you would simply modify the a tags to link to result.php instead of their original link.
However, based on the way you worded your post, I'm guessing that you don't have control over the contents or <a> tags inside the pages in your iframe, and in that case what you're trying to do is impossible.
November 14th, 2012, 05:11 AM
Hm that's too bad. Thanks for clearing it up.
November 14th, 2012, 05:33 AM
One thing though. Even the simple codes when i do control the link don't work at all. How is that? For instance i changed the testpage now, check it out:
Only code i've used is this:
why doesn't this even work? According to every source on the web this has to work.
<a href="http://www.google.nl" target="vidframe">Dit is 3e test.</a>
<iframe name="vidframe" id="vidframe" src="" width='250px' height='250px'></iframe>
November 14th, 2012, 05:37 AM
aha, i think it had to do with the google link I used as a test site. I used another site and it works, so nevermind.
November 14th, 2012, 10:52 AM
It doesn't look like they are willing to change the iframe. So here's what i was thinking to solve this:
Where there is a form resembling the form the site in the iframe has. But this form is on my own site, with values resembling all the values of the iframe form. But the iframe with the 'original' form is not on this page!
When clicking 'submit' on my own form on page A, it needs to go to this page B. Page B is also my own page, but here you will find the iframe. The form in the iframe needs to be filled & submitted automatically when someone fills and submits my own form on page A (matching form values).
I think this would be possible, right? I'm a long time roboform user and this standalone program doesn't care if a form is in an iframe, it fills and submits everything automatically. I assume doing something like this on a website isn't working that much different?
I am now looking into CURL as this looks like it would do what i want, never used it before though so it's new to me. Would this work?
November 14th, 2012, 07:32 PM
If this were not the case, then your original approach would have been possible because you could have dynamically modified the contents of the iframe to change the URLs of the <a> tags.
It IS possible to do this using cURL, or any server-side language for that matter. Effectively what you have to build is a proxy. The end user sends a request to your site, your site sends a request to the remote site, the remote site sends a response to your site, your site modifies the response and then sends it back to the end user.
November 15th, 2012, 10:41 AM
Good news, thanks for the clear answers. I've got some work to do!
Originally Posted by E-Oreo