PDA

View Full Version : silverlight object is not obeying base href url



jeffmaze
02 Apr 2010, 10:04 PM
I'm having trouble getting my silverlight object to render on my page under the following conditions.

My page has a base href set to the root of my site i.e. "http://localhost/".

My page is in a folder like "http://localhost/samples/"

My silverlight object lives in a folder off the root of my site "http://localhost/files/test.xap"

The source URL to my silverlight file is relative to the base url i.e. "files/test.xap"

The silverlight object seems make the source url relative to the url in the address bar rather than the base url set using the <base> tag.

Is there something I can do to get my silverlight objects to render using the relative url to the base href?

Here is some sample html of what works and what does not.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="EN-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Silverlight Relative URL Test</title>

<base href="http://localhost/" />

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head>
<body>

<div>URL Relative to base does not work i.e. "files/test.xap"</div>

<object style="width: 200px; height: 100px;" data="data:application/x-silverlight-2," type="application/x-silverlight-2">

<param name="Source" value="files/test.xap" />

</object>

<div>URL Relative to Web Root works i.e. "/files/test.xap"</div>

<object style="width: 200px; height: 100px;" data="data:application/x-silverlight-2," type="application/x-silverlight-2">

<param name="Source" value="/files/test.xap" />

</object>

<div>URL Relative to Browser Address Bar works i.e. "../files/test.xap"</div>

<object style="width: 200px; height: 100px;" data="data:application/x-silverlight-2," type="application/x-silverlight-2">

<param name="Source" value="../files/test.xap" />

</object> </body>
</html>