472,995 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,995 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 15835
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.