Currently, to run XAP an HTML page must specify a .xal uri. Since it is
quite possible that much of the time people will want to run Foo.xal
from Foo.html, this suggests the following:
How about this default? When Xap.createEmbeddedApplications() is run,
if it finds an element with an applicationName attribute but no
startPage, e.g.
<div id="myId" applicationName="MyApp" />
that it will look for the current URI up to its last period, with ".xal"
appended, e.g.
http://foobar.org/tester.html ---> http://foobar.org/tester.xal
http://foobar.org/tester.yet.another.bit.html --->
http://foobar.org/tester.yet.another.bit.xal
and so on. (We can do this because every web page knows its own URI:
"location.href" in browser Javascript.) The XAP-created elements will
end up within the div specified.
This seems pretty straightforward and useful to me.
Less straightforward, but still useful: if _no_ element can be found
with either an applicationName or a startPage, generate an
applicationName, look at the .xal page found as above, and make the
XAP-derived elements descendants of the page's <body/> tag. This would
have the effect of allowing a very simple html page to call the xal:
Foo.html
========
<html>
<head>
<!-- Ideally, we can even set the page title from the .xal
page---we can already do
this for Firefox, though IE balks at it.
-->
<script language="JavaScript" type="text/javascript"
src="../../xapcore.js"></script>
</head>
<body onload="Xap.createEmbeddedApplications()"/>
</html>
Foo.xal would then be loaded and the html elements created from it
placed under <body/>.