Page 1 of 3 123 LastLast
Results 1 to 20 of 42
  1. #1
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Question Can an internet page invoke a local applet?

    I'm writing software for a hardware device and I want to make a kind of "plug-in" so that websites who want to support the hardware device can do so. Can I make an applet that the user initially installs on their computer, that can then be invoked any web page, and also talk to the page's JavaScript?

    Can I make the applet's directory location an "environment variable" which can be used by the websites' JavaScript/HTML? What needs to be typed in the JavaScript/HTML to use this variable? Is this possible on Win, Mac and Linux?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    What software is being used? Does the user have a special program for this on their PC or is s/he using a normal browser?
    Applets need permission to access a user's PC.

    JNLP applet launcher may allow some of what you are looking for.
    Take a look at: https://applet-launcher.dev.java.net/

  3. #3
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    My questions are simple.

    I simply want to know if a web-page can kick-start a locally-residing applet, e.g. at C:\myfolder.

    Also, can this locally-residing applet talk to the JavaScript on the web-page.

    And if so, also any recommendations for making this as general as possible between OS platforms and what the applet's chosen location was (e.g. using a general stored variable for the path, queried via the HTML/JavaScript to load the right applet).

    All without any security questions being asked to the user.

    I'm choosing a local applet precisely because it has more privileges to access the hardware process.

    Many thanks,
    N
    Last edited by Navigateur; 08-13-2010 at 03:35 PM.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    if a web-page can kick-start a locally-residing applet,
    Read the pages at the link I posted.
    Otherwise I don't think a normal web page can do anything on a local computer.

    All without any security questions being asked to the user.
    I sure hope it would NOT be able to do anything without asking the user.
    Do you want third party software walking around on your PC?

  5. #5
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Navigateur View Post
    My questions are simple.

    I simply want to know if a web-page can kick-start a locally-residing applet, e.g. at C:\myfolder.

    Also, can this locally-residing applet talk to the JavaScript on the web-page.

    And if so, also any recommendations for making this as general as possible between OS platforms and what the applet's chosen location was (e.g. using a general stored variable for the path, queried via the HTML/JavaScript to load the right applet).

    All without any security questions being asked to the user.

    I'm choosing a local applet precisely because it has more privileges to access the hardware process.

    Many thanks,
    N
    Sure it can :)
    But it is good to use JAR file only to run local applets with local web pages
    The applet code must be careful with getDocumentBase() method then ;)
    Last edited by Webuser; 08-14-2010 at 02:03 AM.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    @Webuser Always looking for new tricks: Can you explain how a web page loaded from a server can start a locally-residing applet? By web I mean via an HTTP connection to a server not a local HTML page.
    By locally-resident I mean the client's hard drive.

  7. #7
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Wink

    @Norm
    what about temp folder :rolleyes:
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    What is and where is temp folder?
    What does that have to do with the OPs question?

  9. #9
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Norm View Post
    What is and where is temp folder?
    What does that have to do with the OPs question?
    author will have to simulate JRE (or IE) temp folder content :rolleyes:
    that's a good old cache trick :D

    or maybe it is better to write a client runner by starting a local web page relative to a local applet :confused:
    I mean a web page which contains local html docs file:// refs. So user can invoke local web pages by clicking the downloaded one from the host web page :)
    It is a knot web page effect as I can remember ...
    Last edited by Webuser; 08-14-2010 at 03:37 AM.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Can you explain with an example or a link to a site that explains it better?

  11. #11
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    I think the second way of knot page is more easy...

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Sorry, you are not making any sense for me.
    How is a local html file a web page???
    What is a "knot" page?

  13. #13
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    What happens when you simply type "file:///C:/myfolder/UsersLocalApplet.class" from the web page?

    Again, this is simply for a hardware user-input device that web pages want to support, via an applet that the user has pre-installed once because they TRUST that applet's intent.

    I'm not trying to be malicious!

    That's why I want it to work without further user intervention (just work smoothly every time they go to a site that supports the hardware user-interface). Which is why I don't think a "knot" page (if it has to open another window or require a click) is suitable.
    Last edited by Navigateur; 08-14-2010 at 01:47 PM.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    What happens when
    A good way to get answers for 'what happens when' questions is to write a small test program and see "what happens".

    Try it and let us all know "what happens".


    "file:///C:/myfolder/UsersLocalApplet.class" from the web page
    Where/how is this coded in the html page?
    Last edited by Norm; 08-14-2010 at 01:57 PM.

  15. #15
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    Try it and let us all know "what happens".
    I'm sorry but I don't yet have the facilities for this. I haven't started the Java development nor an SDK+environment downloaded since I don't even know if Java is a solution for me.

    Before I choose Java, I want to know if it is.

    I was hoping that someone who's done some Java applets already knows.

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    I don't know of any way for an applet to read files from a client's local PC without the applet having permission. The link in post#2 shows how an applet can get data from a local PC when using signed jar files.

  17. #17
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    I don't know of any way for an applet to read files from a client's local PC without the applet having permission. The link in post#2 shows how an applet can get data from a local PC when using signed jar files.
    You're right that an applet residing on the website's server doesn't have implicit permission to use local resources. Your JNLPAppletLauncher suggestion is another such example, and requires a security question to give permission, just like signed applets do.

    My question is unbelievably simple, and since I haven't got the Java SDK/environment, I'd just like to know: What happens when a web page tries to launch a locally-residing applet using a "file:///" path? Since the user has installed that applet on their machine because they trust it, and since locally-residing applets DO have access to local resources, if the web page launches the local applet no problem, and it can talk to the JavaScript on the web page, then I'm all set! All I need is a yes/no if this happens, before choosing Java.

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    I have a server for testing I used for this. The html/applet worked in an older browser but not in the current ones. The jar file was in C:\Temp

    FireFox 3.6.3:
    Security Error: Content at http://127.0.0.1:8081/Testing/AppletReaderFromTemp.html may not load or link to file:///C:/AppletReader.

    Chrome 5.0.375:
    Not allowed to load local resource: file:///C:/Temp

    Worked in older browser: Mozilla 1.7.13

    Failed in IE8 - Couldn't find any error message

    The URL: http://127.0.0.1:8081/Testing/AppletReaderFromTemp.html


    The HTML:
    <HTML><HEAD><TITLE>Applet Reader using Jar from C:/Temp/</TITLE></HEAD>
    <BODY BGCOLOR="#123456">
    <APPLET CODE=AppletReader Archive="AppletReaderSInTemp.jar" codebase="file://C:/Temp" WIDTH=300 HEIGHT=300>
    <PARAM NAME=FILENAME Value="C:\\AppletTestFile.txt">
    </APPLET>
    </BODY></HTML>

  19. #19
    Navigateur is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    Thanks so much Norm, you've helped me a lot.

    I wonder if this restriction is bypassed if the user runs a local webserver hosting the applet, and accessed via "http://localhost" instead of "file:///".

    Please don't go to any trouble if nobody already knows. Thanks so much again to Norm for his reply! N
    Last edited by Navigateur; 08-15-2010 at 01:43 AM.

  20. #20
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    a local webserver hosting the applet
    Can you explain what that means? How many people have servers on their machines?

    accessed via "http://localhost" instead of "file:///".
    You use http:// to go to a server.
    You use file:// to go to a local disk

    If you are going to load a program on peoples' computers, why not make it an application that they can run vs requiring them to connect to a server using a browser and have the server send an html page that tries to trick the browser into read an applet file from the user's disk.

Page 1 of 3 123 LastLast

Similar Threads

  1. Internet Explorer not update applet
    By billlin in forum New To Java
    Replies: 24
    Last Post: 07-18-2010, 12:45 AM
  2. Replies: 0
    Last Post: 02-16-2009, 08:05 AM
  3. Replies: 8
    Last Post: 02-08-2009, 11:58 PM
  4. Invoke Applet
    By chankokchern in forum Java Applets
    Replies: 1
    Last Post: 07-29-2008, 04:35 PM
  5. Getting url of page applet is running on
    By damounh in forum Java Applets
    Replies: 1
    Last Post: 05-09-2008, 05:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •