473,799 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controlling JavaScript across frames

1 New Member
Hello!

This is my first posting here! :-) I hope you can help me...

To sum it up:
I have a question about the possibility to influence the execution of JavaScript in another frame. I cannot modify that other frame's code, but it does come from the same server. Therefore, there should not be an issue with any cross-side scripting restrictions.

In more detail:
I am working with a legacy web-app (strange as this may sound), which generates HTML with various more or less fixed programs. For a variety of reasons, we do not really want to mess with the source code of that application. Doing so would complicate things, make things terribly expensive, etc.

Yet, we would like to put the output of this old application into the new navigation framework that we are designing. And quite literally, we are using frames for that.

Unfortunately, the people who wrote the original code thought they'd be very clever by putting frame-break-out code into their output. For the most part, this simply looks like this:

Expand|Select|Wrap|Line Numbers
  1. if (window != window.top) {
  2.     window.top.location = window.location;
  3. }
  4.  
The formatting is not always that nice, and there are variations, but for the most part, that's what it is.

I don't want to disable JavaScript, and preferably, I also don't want to have to parse through all the content of the other frame, since this would be very messy.

But since my frame and frameset code will be served from the same server and domain as the legacy code, could I do something before or while that other frame loads, which would 'trick' this other frame into thinkig that it is indeed on top?

Any help would be greatly appreciated.

Thank you very much!

Tom
Oct 5 '05 #1
2 2896
acoder
16,027 Recognized Expert Moderator MVP
Interesting problem.

Usually, force-frame scripts involve modifying the child pages. If this is added on load, you can overwrite the onload by setting window.onload to null. If that's not possible, you can try replacing any line which sets window.top.loca tion or top.location with a comment, i.e. put // before those lines, using server-side code.
Jun 17 '08 #2
rnd me
427 Recognized Expert Contributor
i think object tags have a different behavior, it might be possible to restrict them more?

you could also ajax in the url, and place it in a data url, and set the iframe to that.
that breaks the parent connection, because its from a different domain and protocol.

also an anon pop-up might work...
Jun 18 '08 #3

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

Similar topics

4
3846
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 beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
3
1460
by: Joop Kaashoek | last post by:
Just confirming, it looks like an Internet Explorer browser window can not be manipulated by JavaScript to hide its menu bar etc, is this correct?
2
3144
by: Jenn | last post by:
Hi, I have a page that I am setting up at http://www.extravaganzadesign.com/aw/frame.htm I am using a frame on top for some navigation and the frame below for content that will go to external sites. I want to be able to have buttons in my first frame that function as "previous page" and "next page" when applicable. I am trying to figure out the code to make this work. Right now I have a function set up as: <script...
7
3163
by: ABC | last post by:
I am a total newbie to javascript. I have only done Frontpage. I am trying to do a page of image show----I only managed to find a javascript to create pop up windows for the chosen image. Almost good but I want better. http://www.fontstuff.com/frontpage/fptut17.htm I want the viewer to lick on the text word in the main page and the corresponding image will show in the iframe instantly, (or text in the frame and image on the main...
6
1365
by: Leythos | last post by:
I have a site at http://www.bhlnet.net/opep, it's template site for testing, it uses roll-over images that are setup/controlled by javascript. I've just noticed that the pages seem to be stuck with READ/Waiting in the status message. When I use IE I don't see the READ/Waiting. If I remove the js I don't see it, if I refresh the page and don't hold the mouse over any button I don't see it, I've tested with virgin code.... Any ideas?
6
2835
by: Tom Braun | last post by:
Hello! My first post here... I need to monitor if someone clicked on some (any) link in a subframe. Due to certain restrictions, the only place I can put some JavaScript is in the main (frameset) page, though. It appears you can do somehing like document.onClick = blah to ensure that the function blah is called when someone clicks on a link in the
11
16962
by: Rob | last post by:
I know, I know, don't use frames. Well, I'm stuck with these frames and I'm trying to add functionality without a complete redsign. You can look at this as a nostalgic journey. Anyway, I've got the following frame structure at the top level: FRAMESET CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"> <html><head><title>Server List</title></head> <frameset frameborder="1" border="1" framespacing="1" rows="10%,89%">
16
1846
by: Phlip | last post by:
Javascripters: I have a page with an iframe inside. Let's say the iframe looks like this: <script src="/javascripts/prototype.js" type="text/javascript" /> .... <iframe id='grinder' src='sample.html' > </iframe> That prototype.js gives us goodies like $(). And sample.html looks a little
15
2276
by: Phlip | last post by:
Javascripters: I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The inner frame should hit a page on the same (private) web server, so this is not a cross-site scripting attack. But I would prefer not to taint the target page with any extra logic to do this. (I will if I must.) The calling page has these elements:
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.