473,399 Members | 3,038 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,399 software developers and data experts.

iframes and parent window

I have an IFRAME on a webpage with a large height to accommodate a big
list output in the frame.

If I go down the list and click a row, a new page opens in the IFRAME,
but this is a problem if the list is long since the user must then
manually scroll up to the top of the parent page to see the new page.

Is it possible to scroll the parent window to the top using javascript
whenever the page in the IFRAME changes?

Thanks!
--

"I hear ma train a comin'
.... hear freedom comin"
Jul 23 '05 #1
9 15862
Stimp wrote:
I have an IFRAME on a webpage with a large height to accommodate a big list output in the frame.

If I go down the list and click a row, a new page opens in the IFRAME, but this is a problem if the list is long since the user must then
manually scroll up to the top of the parent page to see the new page.

Is it possible to scroll the parent window to the top using javascript whenever the page in the IFRAME changes?

Thanks!
--

"I hear ma train a comin'
... hear freedom comin"


Might try...

<script type="text/javascript">

if (parent) parent.location.hash = '#';

</script>

(in the iframe document)

Jul 23 '05 #2
On Fri, 11 Feb 2005 RobB <fe******@hotmail.com> wrote:
Stimp wrote:

Might try...

<script type="text/javascript">

if (parent) parent.location.hash = '#';

</script>

(in the iframe document)


I tried something like that, putting the function in the <body
onload> call, but I got a 'permission denied' javascript error.

The page is .asp, so I wonder does that have any affect on the
permissions between parent and iframe content?
--

"I hear ma train a comin'
.... hear freedom comin"
Jul 23 '05 #3
rf
"Stimp" <re*@spumco.com> wrote

[iframed page]

I tried something like that, putting the function in the <body
onload> call, but I got a 'permission denied' javascript error. The page is .asp, so I wonder does that have any affect on the
permissions between parent and iframe content?


No it does not. The browser knows nothing about asp or any other form of
server side sripting for that matter.

You are trying to use javascript across different domains (I assume your
iframed page is from a different domain to your main page). This is not
allowed for security reasons.

--
Cheers
Richard.
Jul 23 '05 #4
On Sat, 12 Feb 2005 rf <rf@.> wrote:
"Stimp" <re*@spumco.com> wrote

[iframed page]

I tried something like that, putting the function in the <body
onload> call, but I got a 'permission denied' javascript error.

The page is .asp, so I wonder does that have any affect on the
permissions between parent and iframe content?


No it does not. The browser knows nothing about asp or any other form of
server side sripting for that matter.

You are trying to use javascript across different domains (I assume your
iframed page is from a different domain to your main page). This is not
allowed for security reasons.


aye that would be it... essentially we are creating a system for
affiliates to our web site where they can include the iframe on their
own site (different domain obviously) and the iframe will process pages
from our domain.

This is only a temporary measure.. ideally we would store the affiliate
pages on our own server and the affiliate could upload their own header
and footer for the page.

Assuming that we can add javascript to both the affiliate's page and the
iframe content, is there an alternative approach I should look at for
the problem of scrolling the main page to the top when the iframe
changes?

I don't suppose there's something like:

onIframeChange='parent.scroll(0,0)'

to detect when the iframe content refreshes?
--

"I hear ma train a comin'
.... hear freedom comin"
Jul 23 '05 #5
rf
"Stimp" <re*@spumco.com> wrote
On Sat, 12 Feb 2005 rf <rf@.> wrote:
"Stimp" <re*@spumco.com> wrote

[iframed page] You are trying to use javascript across different domains (I assume your
iframed page is from a different domain to your main page). This is not
allowed for security reasons.
aye that would be it... essentially we are creating a system for
affiliates to our web site where they can include the iframe on their
own site (different domain obviously) and the iframe will process pages
from our domain.


Thought so. Accept that this will not work then.
This is only a temporary measure.. ideally we would store the affiliate
pages on our own server and the affiliate could upload their own header
and footer for the page.
Better. In the same domain you can do whatever you want.
Assuming that we can add javascript to both the affiliate's page and the
And how would the affiliate feel about you adding stuff to their page? I for
one would no longer be an "affiliate".
I don't suppose there's something like:

onIframeChange='parent.scroll(0,0)'

to detect when the iframe content refreshes?


Sorry, no comment. I don't use iframes and I abhore their use by other
authors, just like I dont use and abhore frames in general.

HTH
--
Cheers
Richard.
Jul 23 '05 #6
> Sorry, no comment. I don't use iframes and I
abhore their use by other
authors, just like I dont use and abhore frames
in general.


Don't abhor frames in general. They do have their use depending on what
you're doing.

For example, I created a live chat application using javascript. It could
never have been possible without iframes.

On the question of auto scrolling a page to the top, crossdomain scripting
is just not allowed in javascript. The only way I know of is to have your
affiliates add the necessary code themselves.

Jul 23 '05 #7
On Sun, 13 Feb 2005 phpcode <qu*******@oasisoflove.com> wrote:
Sorry, no comment. I don't use iframes and I
abhore their use by other
authors, just like I dont use and abhore frames
in general.


Don't abhor frames in general. They do have their use depending on what
you're doing.

For example, I created a live chat application using javascript. It could
never have been possible without iframes.

On the question of auto scrolling a page to the top, crossdomain scripting
is just not allowed in javascript. The only way I know of is to have your
affiliates add the necessary code themselves.


Assuming that they add the code themselves, what code would they need to
add?

Cheers.
--

"I hear ma train a comin'
.... hear freedom comin"
Jul 23 '05 #8

I too am interested in this. I control two domains and can freely add
javascript to both pages. Is there a way for the iframe to tell the
parent what its height and width are? I understand the security issue,
but shouldn't there be a way form people who obviously own both domains
(ie javascript in iframe and parent)?

Thank you for your time,
David
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #9


I figured this out. In my case, you must put

document.domain="somedomain.com";
this will allow you to use subdomains and different ports. It will
not, however, let you use completely differnt domains.
---david

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: bscofield | last post by:
What would be the danger in having a lot of hidden iframes? i.e. potentialy 30-40. I need to store a bunch of data and thought about using hidden iframes to do it but wasn't sure if this would bog...
1
by: Tom Szabo | last post by:
I have been learning and practicing JS for a few weeks now. I have a good understanding of most things and came up with a few complex modules. Basically I am almost comlpleted my library code that...
6
by: adnanx82 | last post by:
Hi, I was wondering if anyone knew how to perform the following 2 tasks in Javascript: 1) distinguish between frames and iframes (during an onload event for example) 2) figure out whether a...
8
by: Ashish | last post by:
Incase the problem got bogged down reposting... Hi Gregory, I think I didnt make myself much clear. The problem is: 1. I have one ASP.NET application (no classic asp) and it has a main page...
1
by: John | last post by:
Hi all, I have a page which contains a few usercontrols inserted into placeholders on one main page. Inside one of these usercontrols is an iFrame tag which loads a page. If a user clicks on...
7
by: shocron | last post by:
problem: input values not recognized in dinamicly loaded IFRAMEs here is the thing I have a parent window that has an IFRAME I then load a diffrent page into the IFRAME that contains an input ...
3
by: asdfghjklqwertyuiop | last post by:
Hi, I have been stucked with an issue related to Multiple iframes in IE-7 and session cookie since last couple of days. It will be highly appreciated if any one can provide me a solution for it....
2
CroCrew
by: CroCrew | last post by:
Hello everyone, I am building a page that has two iframes (xFrame1, and xFrame2) in it. Both the pages in the frames are the same and have like JavaScript function names within them. I want...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.