View Full Version : Opening link within an iframe in an iframe !?!
dhtmlhelp
09-09-2002, 10:22 AM
Hi,
I seem to have a problem.
Let's say my domain is www.domain.com. I have a page index.html. This page has an iframe (let's call it Indexframe) where home.html is loaded.
Home.html has a link to www.anotherdomain.com. This link should be opened inside another html file (home2.html, which is loaded within IndexFrame) and inside yet another iframe (let's call it InsideIndexFrame).
In short how can I get to load a link
from IndexFrame>Home.html>LINK
to IndexFrame>Home2.html>InsideIndexFrame>(LINKPAGE = www.anotherdomain.com).
In summary:
Index.html > IndexFrame > Home.html > LINK
should lead to:
Index.html > IndexFrame > Home2.html > InsideIndexFrame > www.anotherdomain.com
hope it makes more sense like this. If you have a solution could you post the code.
DHTMLHELP
ConfusedOfLife
09-09-2002, 04:56 PM
You surely know how to change the contents (HTML file) of an iframe through html, you define and id for it and then you call it, like this:
<iframe id="1" src="something.html"></iframe>
<script>
document.getElementById("1").src = "somethingelse!.html";
</script>
ok? so, for doing what you want, I say that if your first document, whatever it is and how many iframes that it has, has a link, clicking on that link, you need another html file to be opened inside one of your current pags' iframes, that that html file also has another iframe with another html file that you like, ok? ( a little bit complicated! ), it means you wana have the following in one of the iframes of your current file, that you called that yourself IndexFrame, huh? Ok, if the last NESTED iframe that you have, I mean that InsideIndexFrame has always one constant html page, means that you don't change it, put that anotherdomain in that from the begining. I mean make the home2.html, then put an iframe called InsideIndexFrame in it, and sets its src to target your anotherdomain, then when someone clicks on a button in home.html, you just change the src of that IndexFrame to target the home2.html, so, it's finished!
But if you wana target the inner most iframe, i.e InsideIndexFrame, from home.html directly, then I would say that I don't know what to do! Because iframes are not like frames ( at least I think ) that you can refer to them through their array, and the following lines are all wrong!
document.getElementById("myIFRAME").getElementById("anotherIFRAMEinside_the_first_one").src = "blah.html"
or
document.iframes[0].src = "blah.html"
dhtmlhelp
09-09-2002, 08:59 PM
Hi,
I thought there might be a problem but was hoping there was a javascript solution. let me try to be clearer (I seem to need what you say is impossible to do, but maybe by describing it a bit better someone may understand what solution I need).
Index.html has an iframe (Indexiframe) where home.html is loaded.
Home.html has a LINK to www.anotherdomain.com/process.asp
This link should be opened inside an iframe (Insideindexiframe) which is loaded inside html file Home2.html
Home2.html is loaded within iframe Indexiframe.
I cannot set Insideindexiframe to load www.anotherdomain.com/process.asp automatically because that would prevent the asp file from working properly (The LINK in home.html has specific instrucions which may vary, for example, if the LINK was clicked from Ezine.html).
Is this something I can do !?!
DHTMLHELP
joh6nn
09-09-2002, 09:18 PM
you mean you want to link from home1 to home2, and home2 has an iframe, and you want to specify which page loads in home2's iframe, when you link to it?
if so, that's pretty easy. this is a script that i wrote to do that. if you don't understand it, i'll walk you through it.
http://codingforums.com/ubb/Forum4/HTML/009362.html
dhtmlhelp
09-10-2002, 11:56 AM
Hi Joh6nn,
yes I need some help please. I don't quite understand where each piece should fit. Also note that I do not have access to either process.asp or process2.asp (as below - I cannot modify them).
Index.html>IndexIframe>Home.html>LINK
should lead to
Index.html>IndexIframe>Home2.html>InsideHome2Iframe>www.anotherdomain..com/process.asp
also:
Index.html>LINK
should lead to
Index.html>IndexIframe>Home2.html>InsideHome2Iframe>www.anotherdomain.com/process2.asp
DHTMLHELP
joh6nn
09-10-2002, 02:15 PM
anything in bold, you have to change to fit your site.
this first part goes in home2
<SCRIPT>
function frame_saver()
{
if (self.location.search)
{
self.FRAMENAME.location = "http://www.DOMAIN.com" + self.location.search.slice(1);
}
}
self.onload = frame_saver;
</SCRIPT>
now, when you write your links to home2, write them like this:
http://www.whereever.com/home2.htm?http://www.whereever.com/somepage.htm
and it will load somepage.htm in home2's iframe.
ConfusedOfLife
09-10-2002, 11:44 PM
Index.html has an iframe (Indexiframe) where home.html is loaded.
Home2.html is loaded within iframe Indexiframe.
It seems a little bit confusing! You are saying that home.html is in Indexiframe, then you say that Home2.html is inside Indexiframe too? Am I missing anything?
dhtmlhelp
09-11-2002, 12:32 AM
Hi Joh6nn,
I assume instead of FRAMENAME I should write InsideIndexFrame, and not IndexFrame. is this correct?
Hi Confusedoflife,
home.html loaded inside IndexFrame.
The LINK is in home.html.
home2.html is also loaded in IndexFrame when the link is clicked.
The link however should load inside InsideIndexFrame, which is an iframe in Home2.html.
DHTMLHELP
glenngv
09-11-2002, 02:09 AM
iframes are just like normal frames or windows.
to target a link to open in iframes is similar with frames or windows.
<a href="YourPageHere.htm" target="yourIframeNameHere">Link</a>
dhtmlhelp
09-11-2002, 09:07 PM
Hi again,
I seem to still have problems. Should I be able to load a https://www.etc.com/etcetc page inside an iframe that is within an unsecure/nonSSL page/site?
DHTMLHELP
dhtmlhelp
09-11-2002, 09:18 PM
Hi,
I am using the following in home2.html
<SCRIPT>
function frame_saver()
{
if (self.location.search)
{
self.WHATFRAMENAMESHOULDIUSEHERE.location = "http://www.MYDOMAIN.com" + self.location.search.slice(1);
}
}
self.onload = frame_saver;
</SCRIPT>
and the link in home.html is:
<a href="home2.html?https://www.etc.com/etcetc">LINK</a>
but it's not doing the job ...
Also I seem to have another problem. The Iframe in home2.html needs to have a src="URL" defined (or does it not?, I don't know). Anyway I cannot define it because if I did, process.asp would not work.
Any suggestions?
DHTMLHELP
joh6nn
09-12-2002, 12:59 AM
<SCRIPT>
function frame_saver()
{
if (self.location.search)
{
self.frames['InsideIndexFrame'].location = "http://www.MYDOMAIN.com" + self.location.search.slice(1);
}
}
self.onload = frame_saver;
</SCRIPT>
the iframe doesn't need to have the SRC set. however, it seems to me, that if including the SRC attribute causes your ASP to crash, then there's a problem somewhere in your ASP that you need to look at.
dhtmlhelp
09-12-2002, 01:15 AM
Hi Joh6nn,
I have just sent you a pm. This is what I wrote:
i have tried to apply the script you wrote.
main = IndexFrame
_xclick= InsideIndexFrame
In home.html I have an image link as follows:
<div id="Layer6" style="position:absolute; left:30px; top:433px; width:175px; height:22px; z-index:5">
<form target="main" action="http://www.MYDOMAIN.com/home2.html?https://www.processdata.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@mydomain.com">
<input type="hidden" name="item_name" value="ID">
<input type="hidden" name="item_number" value="00009">
<input type="image" src="../../img/now.gif" border="0" width="175" height="22" name="submit" alt="">
<input type="hidden" name="add" value="1">
</form>
</div>
In home2.html I am using:
<SCRIPT>
function frame_saver()
{
if (self.location.search)
{
self._xclick.location = "http://www.MYDOMAIN.com" + self.location.search.slice(1);
}
}
self.onload = frame_saver;
</SCRIPT>
<div id="Layer6" style="position:absolute; left:23px; top:55px; width:435px; height:205px; z-index:2">
<iframe name="_xclick" scrolling="yes" allowtransparency="true" frameborder="no" border="0" width="591" height="395" border="0"></iframe>
</div>
when home2.html is loaded the iframe inside home2 is empty, it doesn't recognise the format http://www.mydomain.com/home2.html?file.html?https://otherdomainetc.com/etc.html
Am I doing something wrong?
thanks,
DHTMLHELP
joh6nn
09-12-2002, 04:48 AM
<form target="main" action="http://www.MYDOMAIN.com/home2.html?https://www.processdata.com/cgi-bin/webscr" method="post">
that has to actually be your domain.
dhtmlhelp
09-12-2002, 10:39 AM
Hi Joh6nn,
it is my domain, as I have written in my post previous to this. It is not working, what could it be?
Should I not put some script in home.html as well?
DHTMLHELP
MCookie
09-12-2002, 11:12 AM
> > action="http://www.MYDOMAIN.com/home2.html?https://www.processdata.com/cgi-bin/webscr"
I'm pretty sure this will cause a security failure or error. Doesn't it?
dhtmlhelp
09-12-2002, 07:58 PM
Yes,
that's what's happening. Is there any way around it?
DHTMLHELP
MCookie
09-13-2002, 08:16 AM
Not one that you like, I'm afraid.
http://www.MYDOMAIN.com/home2.html has to be a https page too. You need your own secure server for that. Better find a way to get rid of the second iFrame. Sorry.
dhtmlhelp
09-13-2002, 09:50 AM
Hi MCookie,
so you are saying that if home2.html was on https it will work fine?
DHTMLHELP
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.