I have a page that inserts a block of javascript dynamically into the
page "Test.html" . The inserted block, "Block A", then does a
document.write of another script block "Block B". This script block
does its own document.write of one last script block "Block C". The way
this occurs is somewhat out of my control, and I need to find a way to
work within this framework. This only needs to work in IE 5.5 or
better.
My problem is that the code in Block C is not evaluated by the
javascript parser. I can get it to evaluate only by doing a "ctrl+n" in
IE which causes IE to open the current document in a new window. This
also happens to cause IE to re-parse the existing DOM's javascript and
thereby finally execute Block C.
I need a way to have Block C inserted and evaluated without having to
do a CTRL+N. There are the following caveats to the modifacations I can
make.
1.) We can insert/modify whatever script we want in test.html. (With
one caveat, see below.)
2.) We have no ability to modify Block A's source.
3.) We have no ability to modify Block B's source, except in that we
can change the contents of its document.write calls.
4.) We can modify whatever we want with Block C. (Since this block is
just what's written by block C. See below.)
The reason for these restrictions is that some of these scripts do not
belong to us. (They belong to a 3rd party server suit and we cannot
modify them.)
The caveat concerning test.html is that whatever is written will be
written *after* the page has been loaded into the browser. In fact, it
will be written by manipulating the DOM with external code. (This stuff
all lives in a client application hosting an IE control.) The insertion
of the javascript occurs once the IE control says that the current
document is completely done loading.
As it is now, the client application is written to insert the
javascript into either an existing javascript tag in the HEAD, or by
creating a new javascript tag. We can change whatever we want as far as
the contents, but not where it is inserted. Also, once the javascript
is inserted, the client app executes a javascript function of our
choice. Now, we can modify the client application if needed, but I
would really rather avoid that if possible.
Below is the contents of Test.html, as well as Block A, Block B, and
Block C. Be sure to modify the SRC paths where needed.
--------------------------------------
START Test.html
--------------------------------------
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaS cript" TYPE="text/JavaScript">
var content = document.create Element("script ");
content.src = "http://www.somedomain. com/Block_A.js";
content.id = "blocka";
content.languag e="javascript ";
document.getEle mentsByTagName( "HEAD")[0].appendChild(co ntent);
</SCRIPT>
</HEAD>
<body>
This is a test page.<br /><br />
The first time it loads you will see <b>one dialog</b>.<br />
Hit CTRL+N and you will now see <b>two dialogs</b>.<br />
<br />
Click the following button to view the current page DOM contents.
<input type="submit"
onclick="alert( document.docume ntElement.outer HTML);return false;"
value="DOM Source" />
</BODY>
</HTML>
--------------------------------------
END Test.html
--------------------------------------
--------------------------------------
START Block_A.js
--------------------------------------
document.write( "<SCRI"+"PT LANGUAGE='JavaS cript'
SRC='http://www.somedomain. com/Block_B.js'></SCR"+"IPT>");
alert("Block A Written");
--------------------------------------
END Block_A.js
--------------------------------------
--------------------------------------
START Block_B.js
--------------------------------------
document.write( "<SCR"+"IPT LANGUAGE='Javas cript'>");
document.write( "alert('Blo ck C Written');");
document.write( "</SCR"+"IPT>");
--------------------------------------
END Block_B.js
--------------------------------------
Block C is directly written by Block B, so there is no external source
for that. 2 2053
<th*********@ho tmail.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. . I have a page that inserts a block of javascript dynamically into the page "Test.html" . The inserted block, "Block A", then does a document.write of another script block "Block B". This script block does its own document.write of one last script block "Block C". The way this occurs is somewhat out of my control, and I need to find a way to work within this framework. This only needs to work in IE 5.5 or better.
My problem is that the code in Block C is not evaluated by the javascript parser. I can get it to evaluate only by doing a "ctrl+n" in IE which causes IE to open the current document in a new window. This also happens to cause IE to re-parse the existing DOM's javascript and thereby finally execute Block C.
Tested in:
IE 6.0.2900: two alerts, one for Block A, one for Block C
Firefox 1.0: two alerts, one for Block A, one for Block C
Opera 7.54u1: two alerts, one for Block C, one for Block A (yes, in that
order)
So from my testing it seems to do what you want in IE. I did it all from
my local hard disk, so it's possible it's a cross-domain security issue
preventing the script from being executed.
--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
That's very strange that it would work on your machine. I've tested it
both locally and remotely, and I've tested it on multiple machines
(VMWare and real), and it fails on all.
One thing I have noticed is that whether or not it works can be related
to the speed of the machine. For instance, I can get it to work by
placing an alert after the appendChild call in test.html. This blocks
the execution of the rest of the page long enough for the script to get
injected and evaluated.
Unfourtunatly, this doesn't work in my actual setup because the script
being shown as embedded in test.html is actually injected by the client
application hosting the IE control long after the page has completely
loaded.
Any ideas? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus L?ffler |
last post by:
Hi all,
I'm looking for a class to access large memory blocks of dynamic
length in an efficient way.
Basically the simplest way to allocate a memory block is to allocate a
byte .
If you now want that this memory block can grow dynamically, then you
usually allocate a byte of a certain size, then if size is
outgrown, you create a bigger byte and copy the old one to the new
|
by: NickName |
last post by:
/* goal: dynamic evaluation of table row
platform: sql 2000
*/
use northwind;
declare @tbl sysname
set @tbl = 'customers'
EXEC('select count(*) from ' +@tbl)
|
by: Jamie |
last post by:
I am using remote scripting to call a .NET page within a main page. The
child page (child.aspx) returns html that contains dynamically created
javascript methods (function test()).
The parent page sets a document item's innerHTML property to the result of
the child page. This all works fine, except that the parent page also makes
a call to the "test()" method that is contained within that innerHTML. The
call is made after the...
|
by: A Jafarpour |
last post by:
Hi everyone, hope someone can tell if there is any way to,
dynamically, build an statement and then call some
functions to execute the statement. I know examples always
help, so here what I am trying to accomplish:
Dim myStatement as String
myStatement = "Dim result as integer result= 2 * 3"
now is there any way to actually let a program to treat
myStatement as a statment and therefore execute whatever
|
by: Pascal Costanza |
last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monday, February 13, 2006, VUB Campus Etterbeek
The VUB (Programming Technology Lab, System and Software Engineering
Lab), ULB (deComp) and the Belgian Association for Dynamic Languages
(BADL) are very pleased to invite you to a whole day of presentations
about the programming languages Self, Smalltalk and Common Lisp by
experts in...
| |
by: deepres |
last post by:
Hi,
I have the following problem. In my application I'm dynamically
replacing some of web-page content. For example, I have something like
that:
<span id="ui_tr_22_1_treeJ_span" >
<div id="ui_tr_22_1_treeJ"></div>
<script type="text/javascript">
|
by: david |
last post by:
I have a picture and it has onclick event, with invokes JavaScript
function called ModuleManager(); Then it saves a copy of Node (Blocks,
which is DIV) it tmp_blocks with all children elements. And
it changes Blocks innerHTML with new one, which has form and after I
press button which has onclick too and calls another function which
Blocks innerHTML sets to tmp_blocks;
But after that(when I want to press image again) FireFox says:...
|
by: Nehil |
last post by:
can i find about following 2 things, by providing my own API of
functions for a C program :
1) static, global and const section of variables (pointers only), and
to pickout only those which are dynamically allocated.
2) Local variable which are pointers and have dynamically allocated
memory.
Actually, i want to develop an API, which will help in collection
|
by: aarklon |
last post by:
Hi all,
recently a friend asked me is there any dynamic binding in C...??
to which i answered AFAIK it is in C++ only,
but he says it is valid in C.
if dynamic can be implemented via function pointers in C ,
can anyone give an example for dynamic binding in C...??
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |