JaredFish Posted September 8, 2006 Share Posted September 8, 2006 Im looking for a way, through javascript, to check if my page is loaded into my iframe or not, and if not to load it into the required iframe.At the moment I have a script that checks the link for anything after the file name eg.www.mysite.com/index.html?music.html...and it then loads the music.html into the iframe on the index page. My problem is when the user tries to access the page directly eg:www.mysite.com/music.html...I want it to load the music.html page into the iframe on the index page.Which is the best way to do this? Link to comment Share on other sites More sharing options...
Jack McKalling Posted September 8, 2006 Share Posted September 8, 2006 You can apply a little script condition to your music.html, to see if the document is the top document or in a frame. Like this: if (window.top == window.self){ location.href="index.html?music.html" }Literally this will check if the document this script is in (window.self) is the same as the topmost document (window.top), if so, load the document you want it to be. Link to comment Share on other sites More sharing options...
Nicky_Pot Posted September 8, 2006 Share Posted September 8, 2006 How do i get it to use a variable (Adress2$, in my case) instead of a predetermined page ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now