473,395 Members | 1,679 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,395 software developers and data experts.

problem with my script and frames

Currently I have a Greasemonkey script that adds a menu to the top of every
page by adding its self to the DOM. I am having a problem when I visit a
page with frames. The menu gets duplicated in every frame. I know the
problem is that the menu gets appended to the body of all the documents in
the different frames. Is there a way around this without having to use
JavaScript to break out of frames? Currently I am using this to insert the
menu div tag into the body tag: theBody.insertBefore(menuDiv,
theBody.childNodes[0]);

If you need to look at my whole script it is at this location:
http://www.prism.gatech.edu/~gte542u...ective.user.js
It is too long to post the code on the forum

Joseph Scoccimaro
gt*****@mail.gatech.edu
Nov 23 '05 #1
1 1242


Joseph Scoccimaro wrote:
Currently I have a Greasemonkey script that adds a menu to the top of every
page by adding its self to the DOM. I am having a problem when I visit a
page with frames. The menu gets duplicated in every frame. I know the
problem is that the menu gets appended to the body of all the documents in
the different frames. Is there a way around this without having to use
JavaScript to break out of frames?


If Greasemonkey automatically calls your script for every window and
frame then your script can check e.g.
if (window == top)
to find out whether it is currently executed in the top level window
containing the frameset document.
But a menu more likely belongs into a particular frame I suppose so for
named frames you could check
if (window.name == 'someFrameName')
and then inject whatever you want to inject and don't do anything for
the other windows/frames.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ed Blinn | last post by:
Can someone tell me why this script will only work on a Mac with Internet Explorer. Thanks, Ed <html> <head> <script type="text/javascript"> //Square Root
13
by: elad | last post by:
Hi The Menu doesn't work properly when I have 2 frame and the Menu popup frame=document target frame, when I choose item in the menu the doc opened and the menu get stuck. Here is the code...
4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
3
by: Jofio | last post by:
In my frame based page, I have a hyperlink in the top frame called "header" which, when I click, should make two different pages to be loaded and displayed into two different frames, namely...
3
by: krishna | last post by:
Below is the code. language = asp.net/vb.net private sub openW() sResult = sResult & "<script language=javascript> mywindow =...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
5
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.