Is it possible to detect when a request is sent by the browser and when an answer is posted?(with javascript)?
-
I am using jQuery to pop up a dialog box that might contain different things from iframes to image to ajax...I need a way to detect when a request is sent and when the loading is completed ( the answer to the request) in order to create a "loading..." message that would work for any instance. with Ajax it is easy ( ajax status), so it is with an img ( onload action) but iframes I have no idea how to do it...besides it would be nice to have a universal approach for all instead of a specific one for each case. I figured since the browser itself knows when a request is sent ( hence the hour glass and the loading bar) there should be a way to read that...ideally in Javascript if possible...thank you for your help
-
Answer:
Not sure why frame should be a problem. The tags that support onload events are: body, frame (and iframe and frameset), img, link, and script You can use embedded script tags to simulate onload for other elements that can contain script blocks. A simple example of this is: <head> <script type="text/javascript"> // simulate firing onload event for elements // that don't support it function publishEvent(evt, publisher) { // for IE vs. non-IE browsers evt = window.event?window.event:evt; // get script block's parent var el = publisher.parentNode; // do whatever - could be to notify // registered subscribers of events of // given types fired by elements of // given ids alert(el.id + ':' + evt.type); } </script> </head> <body> <div id="div0"> <!-- include.js doesn't need to do anything, but must exist in order for onload event to fire --> <script onload="publishEvent( event, this )" src="include.js"> </script> </div> </body> </html>
Salmane S at Yahoo! Answers Visit the source
Related Q & A:
- Is it possible to crawl through a database?Best solution by quora.com
- How to find a name the a person who sent and email for free?Best solution by Yahoo! Answers
- How do i change my display name when i answer a question?Best solution by Yahoo! Answers
- Is there any way possible to hook up a Speaker Home Theater System in a car?Best solution by answers.yahoo.com
- Is it possible to hook up a HD cable box to a regular tv?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.