how to use objects created by server.createobject in javascript

B

babu17

hi,

i want to fire an event onunload. in the function for the event i want
to use an object created by ASP's server.createobject.

eg:
<%@language = vbscript%>
<%
set obj1= server.createobject("test.test")
%>
<html>
<script>
----- here i want to use obj1 methods---------
</script>
<body onunload="win_unload">
</body>
</html>

thanks
 
T

Thomas 'PointedEars' Lahn

babu17 said:
i want to fire an event onunload.
OK.

in the function for the event i want to use an object created by ASP's
server.createobject.

Not possible directly. You can only make an HTTP request that uses the
server-side object (which is probably recreated every time).
eg:
<%@language = vbscript%>
<%
set obj1= server.createobject("test.test")
%>
<html>
<script>

----- here i want to use obj1 methods---------

See above.
</script>
<body onunload="win_unload">

If this is going to execute something, you probably want win_unload();


PointedEars
 
B

babu17

how can i make an HTTP request.
You said it is not possible directly. so is there any other method to
get it working.
my intention is to store the timeout value in the database using obj1
methods when the user closes browser.

thanks
 
B

babu17

how can i make an HTTP request.
You said it is not possible directly. so is there any other method to
get it working.
my intention is to store the timeout value in the database using obj1
methods when the user closes browser.

thanks
 
T

Thomas 'PointedEars' Lahn

babu17 said:
how can i make an HTTP request.

Using any `http(s):' URI.
You said it is not possible directly. so is there any other method to
get it working.

What I meant is that it is not possible to access the server-side object
from client-side script directly, because neither one "knows" of the other.
However, client-side script can make an HTTP request that will trigger a
server-side application that accesses the server-side object. This will
work only if the server-side object is somehow global, such as stored in a
server-side session.
my intention is to store the timeout value in the database using obj1
methods when the user closes browser.

Strongly recommended against (search the archives), because it is not at all
reliable: onunload executes code that creates an host object that allows to
make the HTTP request (e.g. an Image or IXMLHttpRequest object), and this
object is used in the process. Note that `onunload' will also be called if
one navigates away from the current document, and other event handlers are
proprietary.

Reconsider your application design instead.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top