This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Accessing JavaScript Function of another Web-Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Accessing JavaScript Function of another Web-Application" Watch "Accessing JavaScript Function of another Web-Application" New topic
Author

Accessing JavaScript Function of another Web-Application

sandeep lokhande
Ranch Hand

Joined: Jan 25, 2010
Posts: 118

I want Call a client side method of an Webapplication from outside that application,
Lets say from my application or script, so as to trigger the functionality of that web-application.

I think as we are accessing only client side JS, so we could call the method.

Is it possible? If yes then what should be the approch for the same? Thank you in Advance. :-)


Thanks and Regards,
Sandeep Lokhande.
Micael Carvalho
Greenhorn

Joined: Jul 10, 2012
Posts: 9

Hello sandeep,

In order to call a method outside the application, you have to provide one of the following:

- Webservice;
- RMI server; or
- Sockets server.

In every case, you should implement code in your web application to allow other proccess to comunicate with it and access its methods.
The closer to what you need is RMI, that literally allows you to invoke remote methods, but it will need that both sides to maintain an Interface of which methods may be called.

Please take a look on that.

Micael
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

Micael Carvalho wrote:In order to call a method outside the application, you have to provide one of the following:

None of that is applicable to client-side JavaScript.

And no, you cannot call the JavaScript of another page that was not served from your own domain.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Have you checked out Aspose?
 
subject: Accessing JavaScript Function of another Web-Application
 
It's not a secret anymore!