Launching and Embedding Curl in HTML

VERSION 9 Published

Created on:Oct 24, 2007 7:52 AM by CurlEducation - Last Modified:  Nov 20, 2007 2:10 PM by rhh

Working with HTML

As you have already seen, the browser can directly load an applet, allowing the applet to take over the entire display area of the browser. A Curl applet can also be launched or embedded in an HTML page that the browser loads. Embedding a Curl applet allows the applet to share the browser's display area with HTML content.

For Web pages that contain both HTML and Curl content, the following scenario occurs:

  1. The browser sends a request to the server
  2. The browser interprets the information sent from the server in which HTML is rendered and Curl content is recognized by the browser
  3. The browser starts the Curl runtime environment to handle the Curl content
Let's examine each of these scenarios.

Launching a Curl applet from an HTML file

From an HTML file, users can launch a Curl applet by selecting a link that targets Curl content using the Anchor tag <A>.

Embedding a Curl applet in an HTML file

A Curl applet can be embedded in an HTML page using HTML's EMBED tag. Because of the way EMBED works, you will need to specify the MIME type for the Curl file explicitly in the HTML page.

Your Curl applet will appear within a rectangular area in the HTML page, similar to the way other embedded content appears.

In HTML, use the EMBED tag to specify information about Curl content


<EMBED 
  SRC="embed-applet.curl" 
  TYPE = "text/vnd.curl"
  PLUGINURL = "http://www.curl.com/download/rte/"
  width = "300" 
  height = "300" >


Where:
  • SRC: Identifies the Curl applet that will be launched
  • TYPE: Identifies the MIME type
  • PLUGINURL: Identifies the Curl runtime environment location (if not previously installed on system)

For example:

/wiki/samples/images/embeddedapplet.jpg

Select this link to view the running HTML page:

Embedded Applet

The EMBED tag contains the MIME type for the Curl content as well as the URL information about where to direct the user in the case the Curl runtime is not available on the user's browser. The attributes used in the example do not constitute a full list of what is available for the EMBED tag. However, they are sufficient for creating a working embedded applet.

The HTML code is as follows:

<HTML>
 <BODY>
        
 This is an example of embedding Curl content into HTML. <BR>
        
 This is a standard HTML page, with a Curl applet embedded into it. <BR> <BR>
        
 Beginning of the embedded Curl applet <BR>
 <EMBED 
  SRC="../samples/ServingContent/launch-1.curl"
  TYPE = "text/vnd.curl"
  PLUGINURL = "http://www.curl.com/html/products/surge.jsp"
  width = "300" 
  height = "300" >

 <BR>
 End of the embedded Curl applet.
        
 </BODY>
</HTML>


If you want your applet to take over the entire browser display area, you can just link to its source file directly, rather than an HTML file that embeds it.

/wiki/samples/images/help.jpg For more information regarding Embedding HTML, please refer to the following section in the Curl Documentation:Curl Developer's Guide > File Systems and Networking > Interacting with the Browser


/wiki/samples/images/note.jpg Other ways to run Curl applets...

Average User Rating
(0 ratings)




Oct 31, 2007 9:38 AM Click to view wbardwell's profile wbardwell says:

You can also use the OBJECT tag to put an applet in an HTML page as in:
<OBJECT
DATA = "../samples/ServingContent/launch-1.curl"
TYPE = "text/vnd.curl"
width = "300"
height = "300" >
</OBJECT>

If you are producing a page where users might not have the Curl RTE already installed, you can use some JavaScript code to try to figure out if the plugin is available, but some IE settings make detecting that impossible.

Nov 8, 2007 8:31 PM Click to view Tony's profile Tony says:

Why the Embedded Applet can't be launched?

Nov 20, 2007 2:11 PM Click to view rhh's profile rhh says: in response to: Tony

Oops, that was a bug in the URL for launching the embedded applet. The server name "developers.curl.com" had mistakenly been omitted. Thank you for noticing this problem. It should be fixed now.

-Bert