Scroll To Parent Frame When Can't Control It?

Nov 4, 2011

I have searched the net extensively for a js link code that will scroll to the top of the parent frame.So, link is in iframe within a parent frame that I can't control. Therefore I cannot place any 'a name' attribute in any link in the parent frame. But would like to scroll to the top once the button in my iframe is clicked.I have used most scroll, document scroll to parent etc js functions but none of them scroll to top of parent page and some require a name to be placed in parentthis is my simple link<a href="#">go to top</a>

View 7 Replies


ADVERTISEMENT

JQuery :: Use A Parent-frame - Objected To Make Child-frame AJAX?

Aug 26, 2011

I have a domain: example.com; which is the parent.And a subdomain: api.example.com; which page 'receiver.html' is being loaded in an iframe, child of parent. Both pages set document.domain = example.com.

I'm trying to adapt this code:[url] but Idon't want to load jQuery from the <iframe> again but I need to have the method $.ajax() working from the <iframe> otherwise it would be a cross-domain request and the browser would abort it. I tried ingenuously to set via $('iframe')[0].contentWindow.$.ajax = $.ajax() and I just got a shortcut to the parent page jQuery method. I also tried to "clone" it using $.expand (true...) but the method doesn't work for me; probably because of the complexity of the objected I'm trying to clone. So is there a way for me to use jQuery to have only a $.ajax() method in the <iframe> ? I've thought even about creating a XHR in the child-iframe and then use that in the $.ajaxSetup ({xhr: THATNEWXHR}) but I couldn't do it. I mean, I want to use the XHR factory from jQuery (which has fallbacks for IE, etc) but it has to be created from the iframe-child.

Maybe there is other way to make the AJAX call come from the child-iframe.

If you're wondering "why don't you load jQuery from <script> in the child-iframe", there is a reason... As I'm using jQuery plugins + my own custom javascripts + other independent scripts I created a compiler which minifies each file and bundle them in one. The advantage of this is the reduction of HTTP requests. So "why don't you load that bundle inside the child-iframe?", because it's ugly and Twitter doesn't... Yeah, I like to take Twitter as a reference and I think if they were able to make it so can I;

I got to work in most browsers except IE and Operaby doing it with pure javascript.

I'm "attaching" the code for you guys to test. If you open it with Chrome, Safari or Firefox you will receive 2 alerts one with the return of $.get() and another with the return of a request made via XMLHttpsRequest object. Otherwise (if you open it with IE or Opera) you'll get 'undefined' in the first alert but the real return in the second.

This is the example.com/index.htm:

View 4 Replies View Related

Breaking Out Of Parent Frame If Child Frame Changes URL

Jul 19, 2006

I have a parent document that has a frameset with two frames in it. The first frame is a "header" that runs across the top of the site, and never changes. The second frame contains the "content" of the site. Essentially, I am trying to figure out how to prevent the header appearing above external sites when the user clicks an external link in the "content" frame.

Every time the content frame changes to a new URL, I would like the check that URL and determine if the content frame is changing to an external URL (i.e. different domain in URL) or to an internal link (same domain in URL). If the content is changing to an external link, I want to break out of the frame and just load that external link in the top most document.

I would like all of my javascript to be in the parent document, not spread throughout the individual pages of the site. I was trying to approach this by setting the onunload event handler of the content frame, but I am left with a couple of specific questions:
1. In handling an unload event, can you determine the next URL that the document is loading? Code:

View 6 Replies View Related

Overriding Scroll In External Frame

Mar 4, 2007

I have been developing a website in html and javascript for people to play the game Runescape (www.runescape.com) on.

It uses a textbox and array to open the page of the selected server into a frame, but they have recently added this little bit of javascript to the pages on which the game is embeded.

function init() {
window.scroll(0,0);
}
init();

View 10 Replies View Related

Control Iframe Content Width To Avoid Horizontal Scroll

Apr 19, 2010

I have a page on my website where I put an iframe and display inside it another website, something like this:

<iframe frameborder="0" height="100%" scrolling="yes" src="http://www.another-website.com/" style="overflow: scroll; min-height: 600px;" width="100%"></iframe>

My problem is that my page have a fixed width of for example 800px which the iframe width is 100% of this width, but some external websites I put inside the iframe have a wider fixed width than 600, for example if the external website have the width of 1000px then my iframe will have a horizontal scroll. I don't want the horizontal scroll to appear and at the same time I want the iframe to show the whole width of the external website. Is there a way that I can control the width of the external website and make it 100% of the width of my iframe instead of their fixed 1000px for example? I don't think I can but I thought I would ask anyways maybe it's possible!

View 3 Replies View Related

Set Var In Parent Frame From Iframe

Jan 19, 2007

I have a var in the parent frame called imageon.


Inside my iframe when someone clicks on a thumbnail, I want to change the value of imageon in the parent window.

Here is what I am doing


//I will hardcode the #4 here for this example
i_imageon =4;

/*
here I have to tell my parent page that they clicked on a thumbnail so my parent page knows where to pick up when they start hitting the next or prev arrows
*/
parent.document.imageon = i_imageon;


This is not working. Any ideas? Onclick, I can alert i_imageon and it shows what I need. The problem is, it is not setting the var imageon to this value in my parent frame.

View 3 Replies View Related

Accessing The Parent Frame?

Nov 11, 2010

I'm using an iframe and I have this code in the src file for that iframe.

HTML Code:
if (parent.location == "http://domain.com/store.html"){
document.write("********************************");
}

[Code]....

I've tried self.parent.location, I've tried parent.window.location, I've tried parent.location.href, none of it works.

View 3 Replies View Related

How To Control Child Rows From Parent

Nov 30, 2009

I have a table of data, grouped by Month, Year and then ProjectID:
- Month, Year
- ProjectID
- Job1
- Job2
The Month, Year row controls a collapsable row (ProjectID) and in turn, the ProjectID row controls the Job row(s). The problem I'm having is that if the Job row(s) is open, then 'close' the Month, Year row, the Job row(s) stay visible. How can I control all 'child' rows from the 'parent' Month, Year control?

PHP Code:
<?php
$previousProject = '';
$previousMonth ='';
if ($totalRows_rsInvPending > 0) {
// Show if recordset not empty
do {
if ($previousProject != $row_rsInvPending['projid']) {
if ($previousMonth != $row_rsInvPending['themonth']) {
// for every Project, show the Project ID
?> .....

View 2 Replies View Related

Getting Parent.[frame Name].location Has No Properties

Aug 25, 2006

This is not an IFrame. The frame exists. This is code for a Notes Client. Should be the same as for a browser? Here is my code:

document.bgColor = "blue";
document.frames[0].location =
"/IC.nsf/Get%20and%20Compare%20URLs?OpenView"

OR

document.bgColor = "blue";
document.Frame2.location =
"/IC.nsf/Get%20and%20Compare%20URLs?OpenView"

View 1 Replies View Related

Get Parent Window Title And Url From Frame?

Apr 7, 2010

How do I get the parent window title and url in the iframe? JS code being in the iframe, not parent window.

View 1 Replies View Related

JQuery :: Get All Child Control ID Or Attribute Or Tag Name In Parent Div

Mar 25, 2011

I have a Div control d1and in this div I have furter div and span control.I want to get a list of all element in an array.

<div id="d1">
<div>
<div id="h1">
<div id="h2">

[Code].....

View 2 Replies View Related

Passing Control From Child To Parent Window?

Mar 12, 2010

I am opening a pop up in a new window (window.open) . I have no control on the code of the pop up. Its a third party pop up (twitter). Now that generates a callback url and I can specify that.My problem is the callback page is loaded on the pop up window. I want that window to close and have the call back page loaded on the parent window.

View 1 Replies View Related

Send Refresh Command From Pop-up To Parent Frame?

Feb 25, 2009

I want to send a refresh command from my pop-up screen to a i frame in the parent document.

I have written the following script code...

View 4 Replies View Related

Redirect Page To Open In Parent Frame

Apr 5, 2007

What I'm trying to do is make it so when a visitor or a search engine tries to view a page outside of the parent frame it reloads that particular page inside the parent frame. All the scripts I've tried WILL redirect the visitor back to the parent frame, but NONE of them will then load the previously viewed page into the 'main' frame. I don't want visitors to have to navigate through the site to find the particular page they were viewing.

I have seen this script before but I can't remember which site was using it, also without a redirection to the frames the site won't display properly and navigation would be difficult. Code:

View 1 Replies View Related

Update Parent Iframe Size Without Updating Inner Frame?

May 3, 2009

I have a web page. In that there is a toggle button to show or hide advanced search options. Below that there is a "IFrame A"(Table). IFrame A conatins "IFrame B" (Table Contents). Based on the toggle switch status, i want to update "IFrame A" size without refreshing the "IFrame B".Is it possible to do so ? Can you give me some example or point to some tutorial .

View 4 Replies View Related

Define A Child Of A Frame - What's The Object Opposite Of Parent

Apr 24, 2010

How do I define a child of a frame? What's the opposite of parent.document?

View 1 Replies View Related

Passing Input Values From Parent Frame To Iframe Not Working In Firefox

Mar 5, 2009

To sum up this issue, I have a parent page, which holds some values in hidden input fields passed to them from the url. On this page, I have an iframe with a form in it, to which I want to pass values from these hidden fields to be displayed for the user in the iframe form. In IE, it works. To accomplish this, im just simply doing a <body onload="GetInput()">. The GetInput function does the following, but for about 10 fields:

Fnamefield=document.getElementById('firstname').value = parent.document.getElementById('firstname').value; Thats it. Once the page loads, i see my values. In firefox it does not work. I know the hidden fields are getting their values, but thats as far as it makes it. I have tried calling the GetInput function after the form is written out and not in the body tag, which still works for IE, but not FF.

View 3 Replies View Related

Script In Iframe To Scroll Parent Window?

Feb 24, 2011

The following script will take the option parameter from the page URL and scroll the page to the element which has the matching ID.For example:mypage.html?element3will cause it to scroll to the element which has an id="element3" when the page loads.

<html><head><title></title>
<script type="text/javascript">
function OptionScroll(){

[code]....

View 8 Replies View Related

Close Parent Window - Make The Scroll Bars And Drop Down Boxes Not Trigger The Function?

Jan 4, 2011

Ok so I have a site that I want to automatically close the window when the focus is lost from the page. For example, if the user clicks off the page to something else on there desktop I want the page to close. So far I have managed to do this but the grids on my page and the scroll bars all trigger the close function when clicked on. Is there anyway to make the scroll bars and drop down boxes not trigger the function?

This is the code I have so far.

View 6 Replies View Related

"no Such Interface Supported" When Using Parent.frame.document.location.href

Jul 23, 2005

I have some code that changes a PDF file in another frame using:

parent.frame.document.location.href = "PDF File"

This code works fine the first time it is called. But if a PDF file is
in that frame and the code is called again IE gives me an error:

"no such interface supported"

I have used this code for the past 5 years and it has worked fine with
Adobe Acrobat 4-6 it is only 7 that started to cause me grief. It is
only IE that has this problem, Netscape seems to work fine.

I have checked the web and talked to Adobe and have yet to find a
solution.

View 2 Replies View Related

Go Back History Button On Top Frame That Affects Main Frame?

Oct 15, 2001

Im trying to make a back button that reloads the previous page the user was at.
The back button will be on a small top frame and the page that needs to be controlled will be in the main frame.

The top frame is just a navigation system, and all pages will be loaded in the main frame.
Im trying to use this Code:

<FORM>
<INPUT TYPE="button"
NAME="back"
VALUE="BACK"
onClick="history.go(-1)">
</FORM>

Does anyone know how I could accoplish the desired result using this code, or any other code? And what about a foreward button?

View 2 Replies View Related

Click On 1 Of The 3 Frame Options The Frame Changes Showing A Preview?

Jul 20, 2010

I want to have a main image in place and when you click on 1 of the 3 frame options the frame changes showing a preview. Also I would like the add to cart button change its code to add the correct item as well.

View 2 Replies View Related

Need Next-previous Control To Control Contents Within An IFrame?

Oct 10, 2011

Situation:I have a very long page divided into many sections vertical-wise marked by bookmarks, say pageX.html#s1 to s10. I need to show the section inside an iframe (iFrame1) on the mainpage (mainpage.html). I am thinking of having 4 buttons, sitting on the mainpage, to help navigate between these sections on pageX, namely NEXT, PREVIOUS, TOP, END.condition of the frame, fixed width/height, no scroll, no border.Very new to javascript but need this code to make a page work for BIZ.

View 1 Replies View Related

PASSING Data From One Frame To Another Frame In A Frameset

Aug 30, 2010

i need to pass the data in the textfields from the left frame to the textfields in the right frame of my frameset. (ex: dslnum of frame1 will be pass to txtDSLTN of frame2)[URL]

View 19 Replies View Related

Change Frame Url With Clicking Link In Another Frame

May 22, 2011

I have two frames (frameset, let's call it frame1 and frame2). Frame1 has links..., and frame2. When some link in frame1 is clicked, it must be changed content of the frame2. Here's example: click. How to do that? (I don't see any javascript code)

View 2 Replies View Related

Open The Frame Inside The Main Frame

Jan 10, 2011

I have a little problem, I structure my site with a main page index.html with a frame in the central whit name CENTRALE, so every other page I will open within this frame. Now I need to have a direct link to these internal pages, give an example I wish it were possible to go to the page clothing giving a direct link to that section of the site type www.indirizzo.com / clothing.html because the state of things if I take the 'direct address to that page I open only the part inside of the frame, but I wish I would open inside the "main frame, there is a solution in javascrip to overcome this problem?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved