473,659 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2090
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.googlesyndi cation.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.locati on 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
WebProgressList ener, 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
1774
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? (Without having JS or 'onClick' added to each & every link?) I've looked everywhere but can't find out how, or if it's even possible via Javascript... Regards.
17
4870
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 event ? I've tried something like this: oncl = document.getElementById('mySpan').onclick oncl = oncl + '\n;alert(\'added\')' document.getElementById('mySpan').onclick = oncl
7
3254
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 load one of several controls: private void btnCategory_Click(object sender, System.EventArgs e) { Control myControl = LoadControl(DropDownList1.SelectedItem.Text + ".ascx"); PlaceHolder1.Controls.Add(myControl);
2
1626
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 application as I need to show message after submit button click but before actual unload wich starts after client receive responce from the server. This responce is very slow sometimes. Thus client should be warned. Does anybody know how to solve this...
0
2070
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 if it doesn't exist yet. The event manager uses weakrefs, so lists of listeners won't stop them
1
6947
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 "AutoEventWireUp" = false and also run after removing this tag from page directive but still my page_load event gets called twice. I have 3 pages called Search.asp, Processing.aspx and ConfirmSearch.aspx.
6
19256
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 know, this shouldn't be an issue, but I just can't get it to work. The script only needs to work with Firefox/Mozilla, so XP code isn't an issue. I have tried to open a window like so.
9
3613
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 function is finished the task, then it will notify the caller. So I am planning to create a seperate thread to do the long XML loading function by using - _beginthreadex()
15
3770
by: Phillip B Oldham | last post by:
Are there any python event driven frameworks other than twisted?
0
8428
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
8851
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
8751
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...
0
8629
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
6181
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
4176
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
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
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
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.