473,397 Members | 2,077 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,397 software developers and data experts.

how to get the topmost page's url

i have a page a.html in which i create and iframe with src=b.html and b.html contains another iframe with c.html and c.html contains another iframe with d.html which calls a javascript x.js which should retrieve the url of a.html

all the pages r from diffrent domains

it works fine when i have the js called from c.html but as soon as i add 1 or more pages in iframe i get a permission denied error

im using top.location.href
Aug 8 '07 #1
9 1940
acoder
16,027 Expert Mod 8TB
If the pages are from different domains, you will get a permission denied error. Make sure they are from the same domain if you want to use Javascript to access the topmost page.
Aug 8 '07 #2
well all the pages r in different domains
but it works fine in two cases

when page a has an iframe with src as page b and page b calls the script
then i get the url of topmost page by document.referrer
and
when page a has an iframe with src as page b and page b has an iframe with src as page c abd page c calls the script
then i get the url of topmost page by top.location or window.top

and all pages r from diffrent domains
Aug 8 '07 #3
but when we have more than 3 domains it fails and we get a permission denied error
Aug 8 '07 #4
well sorry for my misjudgment
the page a and page c are from same domain
so it is giving the top.location value correctly
i didnt see that and now when i have page a,b and c all from diffrent domains it gives permission denied error and the only answer i get is by document.referrer that is only between 2 domains
is there a way where i can get the url of topmost page if we have more than 2 domains
Aug 8 '07 #5
there is webpage that has another page in it as iframe and that page has an iframe in which my page is loaded
i need to get the url of topmost page from my script
i tried using document.referrer to get the url but it only gives the url of the page that has my page loaded as iframe but does not give me the url of the topmost page
since it is cross domain i cant use top.location
i read some examples of xmlhttprequest but dont know how to implement it
i need the url of the topmost page in cross domain scenario
can u help me
Aug 16 '07 #6
i think i have made another copy of my prev thread
can a moderator kill this thread
thnx
Aug 16 '07 #7
acoder
16,027 Expert Mod 8TB
i think i have made another copy of my prev thread
can a moderator kill this thread
thnx
I've merged the threads for you.
Aug 16 '07 #8
i saw some examples of xmlhttprequest but cant understand how to implement them
any suggestion on how to get the url
Aug 16 '07 #9
acoder
16,027 Expert Mod 8TB
I doubt whether this can be done if it's from a different domain. If from the same domain, but different sub-domain, you could try:
Expand|Select|Wrap|Line Numbers
  1. document.domain = ...;
Aug 16 '07 #10

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

Similar topics

2
by: JaguarX | last post by:
I have an application that needs a window to stay on top of the other ones, I thought that TopMost = true would be suitable for this feature but it also makes this window to stay on top of all other...
3
by: Hovhannes Asatryan | last post by:
Hello guys. I have a problem with a topmost form. I am writting in C#. I have Mdi Form wich has 2 child forms. I want to set one of them as a topmost window, but when I sets MdiParent the...
12
by: E Goforth | last post by:
Hello, I have a VB6 app that calls a VB.NET app via named pipes and a third party component. Inside the VB.NET app I'm trying to force a form to the top, at least temporarily. Inside a form's...
1
by: SamSpade | last post by:
I learned about the TopMost property from a recent post which solved some problems. But I have a situation where a control wants to make the form it is on be the topmost. It could raise an...
6
by: Strahimir Antoljak | last post by:
I'm running VS.NET 2002 and keep having problems with form keeping on top with its TopMost property. Sometimes my program places the invoked form on top sometimes not. Sometimes when I click on the...
2
by: facicad | last post by:
I would like to set topmost another prog. from my program. Ex: I use AutoCAD, run my prog. from autocad. My prog. is topmost but went I would like to pick some object in autocad, I set TopMost to...
1
by: Phil Galey | last post by:
I have a small application, which is to always stay on top. Another application, which it is supposed to stay on top of, is QuarkXPress 5. I'm using Me.TopMost = True in the Form1_Deactivate...
4
by: Gary Brown | last post by:
Hi, I need a web browser capable of handling video streams and that will stay in front of the Z order. There are a number of video streaming sources I watch that launch a browser window...
1
by: Gary Brown | last post by:
Hi, I have a dialog box that must behave as MessageBox does with regard to the TopMost property. It must be TopMost if and only if the calling form is TopMost. A static method creates the...
2
by: =?Utf-8?B?aGVsZmk=?= | last post by:
Hi all, I have replied with my own questions to an older post entry but after a while I thought it's better to start a new thread based on the previous one. Perhaps with the new thread I will...
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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.