473,708 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

** Dynamically writing html/javascript from a javascript function **

I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).

The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.j s). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.

Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.

I thought what I would need to do to use document.writel n to write
Javascript would be to escape any special characters and to break
apart the script tag ie

document.writel n('<\/SCRIPT>');

would become

document.writel n('<\/SCR' + 'IPT>');

I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.

Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):

index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaS cript1.1"
SRC="showimage. js">
</SCRIPT>
</head>

<body>
Click the house<BR>
<A ONCLICK="newWin dow1('house1.jp g','Nice House')"><IMG
SRC="house1thum b.jpg"></A>
</body>
</html>
showimage.js
------------
function newWindow1(pic, sitename)
{

picWindow=windo w.open('','','w idth=25,height= 25,scrollbars=1 ,resizable=1');
picWindow.docum ent.writeln('<h tml> <head>');
picWindow.docum ent.writeln('<S CR' + 'IPT type=\"text\/javascript\"
LANGUAGE=\"Java Script1.1\" SRC=\"resizewin dow.js\"><\/SCR' + 'IPT>');
picWindow.docum ent.writeln('<\/head>');
picWindow.docum ent.writeln('<b ody onload=\"resize window();\">');
picWindow.docum ent.writeln('<i mg src=' + pic + '>');
picWindow.docum ent.writeln('<\/body> <\/html>');
picWindow.docum ent.close();
}

resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager. I know I have something wrong in the code but I'm not sure
where. I appreciate any comments or tips. Thanks in advance.

cheers
Rob

Jul 23 '05 #1
9 2895
Robby Bankston wrote:
I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).

The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.j s). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.

Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.

I thought what I would need to do to use document.writel n to write
Javascript would be to escape any special characters and to break
apart the script tag ie

document.writel n('<\/SCRIPT>');

would become

document.writel n('<\/SCR' + 'IPT>');

I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.

Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):

index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaS cript1.1"
SRC="showimage. js">
</SCRIPT>
</head>

<body>
Click the house<BR>
<A ONCLICK="newWin dow1('house1.jp g','Nice House')"><IMG
SRC="house1thum b.jpg"></A>
</body>
</html>
showimage.js
------------
function newWindow1(pic, sitename)
{

picWindow=windo w.open('','','w idth=25,height= 25,scrollbars=1 ,resizable=1');
picWindow.docum ent.writeln('<h tml> <head>');
picWindow.docum ent.writeln('<S CR' + 'IPT type=\"text\/javascript\"
LANGUAGE=\"Java Script1.1\" SRC=\"resizewin dow.js\"><\/SCR' + 'IPT>');
picWindow.docum ent.writeln('<\/head>');
picWindow.docum ent.writeln('<b ody onload=\"resize window();\">');
picWindow.docum ent.writeln('<i mg src=' + pic + '>');
picWindow.docum ent.writeln('<\/body> <\/html>');
picWindow.docum ent.close();
}

resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager. I know I have something wrong in the code but I'm not sure
where. I appreciate any comments or tips. Thanks in advance.

cheers
Rob

Hi Rob

I think you should use propper DOM methods if you want to render another
page. If you were to use propper DOM methods you won't have any issues
adding scripts to your pages. To this date I have never seen a REAL need
to use document.write( "html"), except for maybe inline at render time,
there are always other ways.

And I don't understand why you are not loading a very simple html page
and then inserting the img once the popup html has loaded.

You might as well start with a blank canvas of html that you load in to
the new window when it opens. And get that pages onload to call a
funciton in the opener that loads the image and resizes the popup

-------------------- HTML -----------------
<html>
<head></head>
<body onload="opener. ChildLoaded(doc ument)"></body>
</html>
-------------------------------------------
------------------ CODE -------------------

var cPic = "";
var picWindow = null;
function newWindow1(pic, sitename)
{
cPic = pic;
picWindow = window.open("UR LtoSimpleHTML.u rl" ...... );
}

// this function will be called when it's loaded.
function ChildLoaded(doc )
{
// using proper DOM methods to create Elemnts
var eImg = doc.createEleme nt("img");
eImg.onload = funciton ()
{
alert( this.width + " :: " + this.height );
// Do you resizing here on the global var
// picWindow.
}
doc.body.append Child( eImg );
}

-------------------------------------------

HTH

Andy


Jul 23 '05 #2
Andrew Scott wrote:
Robby Bankston wrote:
I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).

The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.j s). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.

Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.

I thought what I would need to do to use document.writel n to write
Javascript would be to escape any special characters and to break
apart the script tag ie

document.writel n('<\/SCRIPT>');

would become

document.writel n('<\/SCR' + 'IPT>');

I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.

Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):

index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaS cript1.1"
SRC="showimage. js">
</SCRIPT>
</head>

<body>
Click the house<BR>
<A ONCLICK="newWin dow1('house1.jp g','Nice House')"><IMG
SRC="house1thum b.jpg"></A>
</body>
</html>
showimage.js
------------
function newWindow1(pic, sitename)
{

picWindow=windo w.open('','','w idth=25,height= 25,scrollbars=1 ,resizable=1');

picWindow.docum ent.writeln('<h tml> <head>');
picWindow.docum ent.writeln('<S CR' + 'IPT type=\"text\/javascript\"
LANGUAGE=\"Java Script1.1\" SRC=\"resizewin dow.js\"><\/SCR' + 'IPT>');
picWindow.docum ent.writeln('<\/head>');
picWindow.docum ent.writeln('<b ody onload=\"resize window();\">');
picWindow.docum ent.writeln('<i mg src=' + pic + '>');
picWindow.docum ent.writeln('<\/body> <\/html>');
picWindow.docum ent.close();
}

resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager. I know I have something wrong in the code but I'm not sure
where. I appreciate any comments or tips. Thanks in advance.

cheers
Rob

Hi Rob

I think you should use propper DOM methods if you want to render another
page. If you were to use propper DOM methods you won't have any issues
adding scripts to your pages. To this date I have never seen a REAL need
to use document.write( "html"), except for maybe inline at render time,
there are always other ways.

And I don't understand why you are not loading a very simple html page
and then inserting the img once the popup html has loaded.

You might as well start with a blank canvas of html that you load in to
the new window when it opens. And get that pages onload to call a
funciton in the opener that loads the image and resizes the popup

-------------------- HTML -----------------
<html>
<head></head>
<body onload="opener. ChildLoaded(doc ument)"></body>
</html>
-------------------------------------------
------------------ CODE -------------------

var cPic = "";
var picWindow = null;
function newWindow1(pic, sitename)
{
cPic = pic;
picWindow = window.open("UR LtoSimpleHTML.u rl" ...... );
}

// this function will be called when it's loaded.
function ChildLoaded(doc )
{
// using proper DOM methods to create Elemnts
var eImg = doc.createEleme nt("img");
eImg.onload = funciton ()
{
alert( this.width + " :: " + this.height );
// Do you resizing here on the global var
// picWindow.
}
doc.body.append Child( eImg );
}

-------------------------------------------

HTH

Andy


Opps, Missed a line of code out...

function ChildLoaded(doc )
{
// using proper DOM methods to create Elemnts
var eImg = doc.createEleme nt("img");
eImg.onload = funciton ()
{
alert( this.width + " :: " + this.height );
// Do you resizing here on the global var
// picWindow.
}

*************** *************** *
eImg.src = cPic;
*************** *************** *

doc.body.append Child( eImg );
}

Sorry about that....

Andy
Jul 23 '05 #3
I use Javascript only occasionally and as such there are a lot of
things I don't know or have forgotten so I'm sure there are stupid
mistakes in not doing this properly and considering that much of this
is done late at night in a sleepy state, I'm sure errors abound.
Thanks for the input though. I'll try it out.

Jul 23 '05 #4
I'm still not sure why the original code bailed (inefficient as it
was), but Andrew's suggestions
worked perfectly. I'd still like to figure out the original problem
but his workaround was
more efficient, cleaner, and of course worked. Cheers.

Let me know and I'll send you some beer or coffee of your choosing.

Jul 23 '05 #5
Lee
Robby Bankston said:

I'm still not sure why the original code bailed (inefficient as it
was), but Andrew's suggestions
worked perfectly. I'd still like to figure out the original problem


You provided a relative path for your .js file, but since the window
was opened without an URL, there was no valid base for it to be
relative to.

Jul 23 '05 #6
"Robby Bankston" <va******@gmail .com> writes:
I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm). .... I thought what I would need to do to use document.writel n to write
Javascript would be to escape any special characters and to break
apart the script tag ie

document.writel n('<\/SCRIPT>');

would become

document.writel n('<\/SCR' + 'IPT>');
No need to split "<\/script>". The only thing that matters is the
sequence "</", which is already escaped ...
I have a HTML page and 2 Javascript files.
.... and that's only important for scripts inside HTML files. For
separate script files, you don't even need to avoid "</".

<SCRIPT type="text/javascript" LANGUAGE="JavaS cript1.1"
Why JavaScript1.1? Do you know what the difference between version 1.1
and later versions is? Just drop the "language" attribute.
function newWindow1(pic, sitename)
"sitename" isn't used. Should it be the title of the window (remember,
the title element is required in valid HTML).
{

picWindow=windo w.open('','','w idth=25,height= 25,scrollbars=1 ,resizable=1');
picWindow.docum ent.writeln('<h tml> <head>');
picWindow.docum ent.writeln('<S CR' + 'IPT type=\"text\/javascript\"
LANGUAGE=\"Java Script1.1\" SRC=\"resizewin dow.js\"><\/SCR' + 'IPT>');
This could just be:
picWindow.docum ent.writeln('<s cript type="text/javascript" src='resizewind ow.js"><\/script>');

(and even without the "\" in "<\/" since it's in a separate js-file, but
it doesn't hurt to keep it as a habit)
picWindow.docum ent.writeln('<\/head>');
picWindow.docum ent.writeln('<b ody onload=\"resize window();\">');
picWindow.docum ent.writeln('<i mg src=' + pic + '>'); Here you should have quotes around the URL:
picWindow.docum ent.writeln('<i mg src="' + pic +'" alt="...">');

resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Try adding an alert at the top level here:
alert("resizewi ndow.js loaded!");
and see.
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager.


Impressive. Sounds like a serious bug. Nothing I can see in the code
itself. Do you have any popup blockers?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #7
I tried using an absolute path as well but since that didn't work, I
just made it relative for brevity.

Since I have a workaround, it is only academic at this point but I'm
still interested in figuring
out this problem.

Thanks all.

Jul 23 '05 #8
I guess out of habit. Many of the examples I learned from in the
O'Reilly Javascript guide (3rd edition) use this attribute and I have
referenced this book many times so I guess it is out of habit.
Why JavaScript1.1? Do you know what the difference between version 1.1
and later versions is? Just drop the "language" attribute. "sitename" isn't used. Should it be the title of the window (remember,
the title element is required in valid HTML).
In the real code, it is used. For the purposes of the example, I
didn't
because it didn't seem relevant and I forgot to remove it from the
post.
This could just be:
picWindow.docum ent.writeln('<s cript type="text/javascript" src='resizewind ow.js"><\/script>');

(and even without the "\" in "<\/" since it's in a separate js-file, but
it doesn't hurt to keep it as a habit)
I'll keep that in mind.
Try adding an alert at the top level here:
alert("resizewi ndow.js loaded!");
and see.
I believe I tried that before but I'll try again.
Impressive. Sounds like a serious bug. Nothing I can see in the code
itself. Do you have any popup blockers?


I have the Google popup blocker for IE but it was disabled for the test
and I have
similar problems under Netscape or Firefox and I know the Netscape
browser doesn't
have any popup blockers installed. Come to think of it, I tried on IE
on a Windows
ME box also that didn't have any popup blockers and it did the same
thing.

Thanks.

Jul 23 '05 #9
my poor example...if the post doesn't kill it.. post your resize script
if you have problems...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><ti tle>Test</title>
<script type="text/javascript"><!--
function nW1(pic,sn){
picWindow=windo w.open('','','w idth=25,height= 25,scrollbars=1 ,resizable=1');
with(picWindow. document){
open();
write('<html><t itle>'+sn+'<\/title><head>\n'
+'<script type="text/javascript"><!-- \n'
+'function rsw(){\n'
+'window.moveTo (0,0);\n'
+'window.resize To(screen.avail Width,'
+'screen.availH eight);\n'
+'alert("resizi ng window");'
+'} //--><\/script>'
+'<\/head><body onload="rsw();" >'
+'<img src="'+pic+'">'
+'<\/body><\/html>');
close();}} //--></script></head>
<body>Click the house<br>
<a onClick="nW1('' house1.jpg','Ni ce House')"><img
src="house1thum b.jpg"></a></body>
</html>

Jul 23 '05 #10

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

Similar topics

10
63602
by: Free-Ed, Ltd. | last post by:
I am going nuts trying to find a paragraph in a book that described how to change the text content (HTML) in a DIV. Actually I have an array of HTML strings that I want to drop into the DIV, depending on button clicks, etc. Putting this stuff into TEXTAREA and TEXT is simple, but I want to be able to mix font families, weights, sizes, and stuff like that. Thanks for your help.
10
7789
by: Richard A. DeVenezia | last post by:
At line this.timerId = setInterval (function(){this.step()}, 100) I get error dialog Error:Object doesn't support this property or method. If I change it to this.timerId = setInterval (function(){this==window}, 100) I see true, the sad fact that 'this' is window and not an anim. What are some proper ways ? I would like to avoid
1
6025
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that required fields in a form have values. I'm writing the values to the client using document.write only so that I can confirm that the values are there to be played with - this is not the final result so please (unless it's leading to the script failure)...
3
12484
by: N. Demos | last post by:
How do you dynamically assign a function to an element's event with specific parameters? I know that the code is different for MSIE and Mozilla, and need to know how to do this for both. I have the following event handler functions defined and need to assign them to table elements (<TD>) created dynamically in another function. function handleMouseOver(elt, cssClass, strURL)
39
6542
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
5
3732
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button. When the user clicks the "Add another email" it will call a client side JavaScript function, add_email, which will dynamically add a new set of controls to the webpage using the innerHTML method. It appears to work perfectly fine in the browser. The...
1
6526
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to java class which creates a xml file based on values entered in dynamic jsp page. Now i want to read all those values entered to xml in my other jsp page. I am able to call values from file in my jsp page. But as dynamic values can be any in no...
2
3385
by: jmarendo | last post by:
Hello, After reading through the "Table Basics - DOM - Refer to table cells" example at mredkj.com , I modified the code for my own purposes. In the modified version, I create a hyperlink and place it in the last cell of each row that I create dynamically using DOM methods. Everything is working well (that is, just like the original example) except for something related to the function behind my link. The link simply calls a function...
11
2729
by: Faisal Vali | last post by:
Are there any guidelines people use that help them decide when it is better to dynamically generate all html elements using javascript versus actually writing some html and using it as scaffolding? I have been using the extjs framework ( I haven't see this library critiqued much on this forum - unlike prototype, jquery and dojo which the regulars here tend to eviscerate - unless i've missed some threads, which is quite possible) and it...
0
8792
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
8699
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,...
0
9293
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...
1
9064
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,...
0
9003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6617
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
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3151
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
2508
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.