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

Is there an event listener for when the page starts loading?

Daz
Hi,

I am trying to find an event listener which will trigger when the pages
starts loading, as opposed to when it's finished, or when the DOM
content has finished loading. I am sure that such a listener exists,
but I can't seem to find it. I would appreciate any pointers.

Many thanks.

Daz.

Dec 28 '06 #1
6 2080
Daz wrote:
I am trying to find an event listener which will trigger when the
pages starts loading,
What would be the point in that? Such an event would have already fired
before a script could add a listener: the document must already be in
the process of loading for a script to executed.

[snip]

Mike
Dec 28 '06 #2
yb
I am trying to find an event listener which will trigger when the pages
starts loading, as opposed to when it's finished, or when the DOM
content has finished loading. I am sure that such a listener exists,
but I can't seem to find it. I would appreciate any pointers.
Any scripts you include in the <headwill execute before the body
starts loading. Just be careful not to reference DOM elements which
haven't been parsed and created yet.

just curious, what do you need to do before the page loads?

Dec 28 '06 #3
Daz

yb wrote:
I am trying to find an event listener which will trigger when the pages
starts loading, as opposed to when it's finished, or when the DOM
content has finished loading. I am sure that such a listener exists,
but I can't seem to find it. I would appreciate any pointers.

Any scripts you include in the <headwill execute before the body
starts loading. Just be careful not to reference DOM elements which
haven't been parsed and created yet.

just curious, what do you need to do before the page loads?
I am making a Firefox extension which will work on named sites, and
strip out the <scripttags for Google Ads, as the page loads. At the
moment, the page is taking 2-5 times longer to load because it's
waiting for ad2.googlesyndication.com. With these stripped, it should
be even quicker. Alternatively, I need to find a way of stopping the
script from even executing, but I am not sure if I can...

Thanks.

Daz.

Dec 28 '06 #4
Lee
Daz said:
>
Hi,

I am trying to find an event listener which will trigger when the pages
starts loading, as opposed to when it's finished, or when the DOM
content has finished loading. I am sure that such a listener exists,
but I can't seem to find it. I would appreciate any pointers.
When the page begins to load, it isn't aware of any of your code,
so how could it possibly invoke your method?

Just put inline code in the <headsection of the page.
--

Dec 28 '06 #5
Daz

Michael Winter wrote:
Daz wrote:
I am trying to find an event listener which will trigger when the
pages starts loading,

What would be the point in that? Such an event would have already fired
before a script could add a listener: the document must already be in
the process of loading for a script to executed.

[snip]

Mike
Hi Mike,

You are right to an extent. The javascript is run from outside of the
page by the browser. It's loaded when the browser is fired up, and
stays there until the browser is closed. What you are saying makes
sense, however. Perhaps I am either looking for something Firefox
specific, as in regular JavaScript there is no use for such a listener,
or perhaps I could do something with the document.location object?

Thanks for your input.

Daz.

Dec 28 '06 #6
Daz

Lee wrote:
Daz said:

Hi,

I am trying to find an event listener which will trigger when the pages
starts loading, as opposed to when it's finished, or when the DOM
content has finished loading. I am sure that such a listener exists,
but I can't seem to find it. I would appreciate any pointers.

When the page begins to load, it isn't aware of any of your code,
so how could it possibly invoke your method?

Just put inline code in the <headsection of the page.
--
Ok, I have just figured it out. What I needed was a a
WebProgressListener, which is completely unrelated to JavaScript. Sorry
for the confusion, and thanks for your input everyone.

Dec 28 '06 #7

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

Similar topics

4
by: Newbie | last post by:
Is it possible to set up an event handler or something else so that when *any* link on the page is clicked it 'fires-up', executes some JS and then continues to process the link that was clicked?...
17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
2
by: Vladimir | last post by:
It appears that this event (window.onbeforeunload) does not fire at least in Netscape 7.0 and 7.1. But window.onload and window.onunload events do! I really need this event handling in my...
0
by: Kamilche | last post by:
''' event.py An event manager using publish/subscribe, and weakrefs. Any function can publish any event without registering it first, and any object can register interest in any event, even...
1
by: puja | last post by:
hi all, I have this .aspx page for which the Page_load event occurs twice. I found out while debugging. After searching google, I tried checking with Page.Ispostback method and also had...
6
by: Daz | last post by:
Hello everyone, I would like to open a child window from the parent, and add an onload event listener to the child window which will tell the parent when the document has loaded. As far as I...
9
by: Eric Kaplan | last post by:
I have a function that will download XML from internet and load XML data into database. The function will take 5 - 20 minutes to finish. I heard I should use event sink (event listener) when...
15
by: Phillip B Oldham | last post by:
Are there any python event driven frameworks other than twisted?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.