473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

a problem with iframes

49
Hi,

I want to put an iframe (or a frame) in a page on my website, with the content in the iframe coming from another website. But I want the entire page to reload when (1) anyone clicks on any link in the iframe, and (2) anyone clicks on any button (after submitting a form) in the iframe.

Then why am I using an iframe? Well, that is a channel on my site being powered by the other site. So the look and feel should be mine, but the block in the iframe comes from them.

Is there any way to do this?

I had an idea (actually this idea was in another site, it's not mine) that I could put all my content in frames too (header, right side ad and footer), and write a JavaScript function like this that I would get the other site to put in the HTML of all its content that appears in the iframe:

function doThree(pageA,pageB,pageC)
{
(parent.frame1.location=pageA);
(parent.frame2.location=pageB);
(parent.frame3.location=pageC);
}

and get every hyperlink on the other site look like this:

<a href="whatever" onclick="doThree('newpage1.html','newpage2.html',' newpage3.html')">ONE LINK changes all frames</a>

The hassle is, they might crib about having to recode a zillion <a href> tags. So is there any way that this could be done in the CSS of the other site itself, by making every hyperlink (anchor tag) automatically run that onclick function, so that I do not have to worry about the manual effort of re-hardcoding several <a href>s, and the missing out that might happen?

I would really, really appreciate any pointers - either a solution to what I asked, or a completely different approach altogether :).

Again, I would want the frames belonging to my content (as opposed to the frame containing their content) to reload even when someone clicks on a submit button.

Thank you for reading this through!
Jun 13 '07 #1
2 1267
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

So you want the website to reload and ignore the URL in the href attribute?
Jun 14 '07 #2
knkk
49
Welcome to TSDN!

So you want the website to reload and ignore the URL in the href attribute?
Yes, that's right. I actually did it (thanks to <a href="http://www.codingforums.com/showthread.php?p=576297#post576297">help</a> - for the benefit of other people who need to do this, here is how:

Expand|Select|Wrap|Line Numbers
  1. var loaded = 1;
  2. function loadMyPages(pageA, pageB, pageC)
  3. {
  4.    if (loaded>1){
  5.          window.frames["frame1"].location.href = pageA;
  6.          window.frames["frame2"].location.href = pageB;
  7.          window.frames["frame3"].location.href = pageC;
  8.    }
  9.    loaded++;
  10. }
  11.  
  12. <iframe src="http://www.othersite.com" onload="loadMyPages('newpage1.html','newpage2.html','newpage3.html')"></iframe>
  13.  
  14. <iframe name="frame1" src="mypage1.html"></iframe>
  15. <iframe name="frame2" src="mypage2.html"></iframe>
  16. <iframe name="frame3" src="mypage3.html"></iframe>
Jun 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Arne Hendrickson | last post by:
Can anyone tell me how to edit this script for "traditional frames" to work with iframes? SCRIPT language="JavaScript"> <!----hide function change2() { parent.left_frame.location="page3.htm";...
6
by: mike | last post by:
I have a page that uses a some javascript and it works fine in IE but fails to work in Firefox. Basically what I'm trying to do is have 3 iframes on a page but only displaying one of them at a...
0
by: Martin | last post by:
I understand that as of IE5.5 iframes respect the z-index style property. However I have noticed some odd behaviour when the iframe's src is set to an MHT web archive instead of an HTML file. ...
9
by: Peter Jenkins | last post by:
I needed to implement a "page within a page" and rather than use frames (yecchh) decided to try using the object tag. Flung a test page together, tried it out in IE and Firefox on my PC, it...
9
by: news | last post by:
I'm working on a new site for my wife's college art organization: http://www.ie-studios.net/mci/ and I'm having a problem where a PDF in an IFrame is supposed to go "invisible" (and in fact is...
5
by: Frances | last post by:
I need to replace iframes acc. to what option user chooses in a sel obj.. but figured have to load a blank iframe when pg loads so I can replace it.. (iframe gets put in a pre-existing div..) this...
2
by: Guadala Harry | last post by:
1. Are IFrames supported only in uplevel versions of IE? If not IE exclusively, what browsers support IFrames? 2. Are IFrames going to be supported in the future - as far as anyone knows - or...
3
by: BG Mahesh | last post by:
hi We are looking for a good Ajax library which has very good support for iframe. The ones we have considered so far are, Backbase.com - not happy with the speed Zapatech.com - it is good but...
1
by: enthusiastic | last post by:
Hi All I have a HTML page where I dynamically created 2 Iframes. The problem is, after this page is loaded & I navigate to some other page & come back using browsers back button, both of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.