SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Javascript 'problem' ?
-
Jun 18, 2002, 12:23 #1
- Join Date
- Mar 2002
- Location
- Ecosse
- Posts
- 398
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Javascript 'problem' ?
Try to access any of my pages outside the frames page I use a script to load it.
It's working fine but in the last two days I get an error asking if I want to debug.
Any ideas why, the codes posted below?
Code:<SCRIPT LANGUAGE="JavaScript"> <!-- Begin if (parent.location.href == self.location.href) { window.location.href = 'index.htm'; } // End --> </script>
"If something is too hard,give it up. The moral my boy is too never try anything"
"Just because I don't care doesn't mean I don't understand"
-
Jun 18, 2002, 12:40 #2
- Join Date
- Jun 2002
- Location
- .chicago.il.us
- Posts
- 957
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Without you posting the actual files, it's hard to tell. But I am guessing that you edit your files with a WYSIWYG editor, and not a text editor, and that path in your links is the location where the file was when you added the link in your page.
-
Jun 18, 2002, 16:07 #3
- Join Date
- Mar 2002
- Location
- Ecosse
- Posts
- 398
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Spot on Randem, I was in a hurry today and had to update my first personal site with Front page. A perfect reason not to use the damn program, it's burnt my fingers again.
I use to wonder why wysiwyg editors got a bad name in the forums, and after using Front page for a while to start learning then 'upgrading' to Dreamweaver, all is now clear. They are a pain in the a#s."If something is too hard,give it up. The moral my boy is too never try anything"
"Just because I don't care doesn't mean I don't understand"
-
Jun 19, 2002, 08:11 #4
- Join Date
- Jan 2002
- Location
- London
- Posts
- 3,509
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
BTW, your JS is slightly flawed - the parent frame is not necessarily the topmost frame of the frameset, and so loading your site's within another site's frameset would not be detected.
Try this instead:
Code:<script language="JavaScript"> if (top.location.href==location.href) { top.location.href = "index.htm"; } </script>
M@rcoMarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code
- Please think, Google, and search these forums before posting!
-
Jun 19, 2002, 09:09 #5
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
but then if it IS in another frameset - and he didn't put it there - surely he'd want to redirect the whole page anyway? ( sorry if i'm overlapping - i haven't read through thoroughly )
In which case he'd be right to redirect the whole page.
If this ISN'T the case - surely he still wants to redirect the frame above his - since it's inside another frame - granted - but he still wants to deal properly with his own site - even if it's inside A N Other
Flawless---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jun 19, 2002, 17:44 #6
- Join Date
- Mar 2002
- Location
- Ecosse
- Posts
- 398
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The main reason I use the script I posted was because the 3 seperate frame elements were being displayed and indexed by search engines. With this script if you saw the 'header/footer,etc' in google it will take you to the main site, fully loaded.
Without it there was no way to find my site. I have since put <noindex> in the files and the problem was solved.
But I still use this script to load the frameset should you try to access a page directly, without the header, footer and links.
The only problem I have with this script is it always loads the index (frames) page, I have no idea how to implement a script that would ensure the header/footer/links were loaded when a page is called seperatly.
Unfortunately javascript is still a little above my head, I only do this for fun. I found the script ready made at this website.
Sorry Marco but what your saying makes little sense to me, can you enlighten me a little.
Thanks in advance!"If something is too hard,give it up. The moral my boy is too never try anything"
"Just because I don't care doesn't mean I don't understand"
Bookmarks