George Adams wrote:
> I would like to be able to create a chunk of code that could be 
> dropped into the body of a web page where I have no access to the 
> <head> to include the needed JSON and Exhibit js files.
> In a html page that works moving the following code into the body 
> doesn't work.
>
> <link type="application/json" rel="exhibit/data" 
> href="ComputerHistory.js">
> <script 
> src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js"; 
> type="text/javascript"></script>
> <script 
> src="http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js";
>  
> type="text/javascript"></script>
>
> Details: Error: Failed to derive URL prefix for Simile Exhibit Time 
> Extension code files
> and Error: Exhibit is not defined
>
> I also tried
> <script  type="text/javascript">
> var loadJS = function(file) {
>    var script = document.createElement('script');
>     script.src = file;
>     script.type = 'text/javascript';
>     document.getElementsByTagName('head')[0].appendChild(script);
> };
> loadJS("http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js";);
> loadJS("http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js";);
> </script>
> without success.
>
> It looks like the error is generated here.
> var url = SimileAjax.findScript(document, "/time-extension.js");
>     if (url == null) {
>         SimileAjax.Debug.exception(new Error("Failed to derive URL prefix for 
> Simile Exhibit Time Extension code files"));
>
>         return;
>     }
>   
>
It's a bit more complex... Try something like this

    var loadTimeExtension = function() {
        window.SimileAjax_onLoad = onEverythingLoaded;
        SimileAjax.includeJavascriptFiles(document, "", [ 
"http://static.simile.mit.edu/exhibit/extensions-2.1.0/time/time-extension.js 
<http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js>" 
]);
    };
    var loadExhibit = function() {
        window.Exhibit_urlPrefix = 
"http://static.simile.mit.edu/exhibit/api-2.1.0/";;
        window.Exhibit_parameters = "?autoCreate=false";
        window.SimileAjax_onLoad = loadTimeExtension;
        SimileAjax.includeJavascriptFiles(document, "", [ 
"http://static.simile.mit.edu/exhibit/api-2.1.0/exhibit-api.js 
<http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js>" 
]);
    };
    window.SimileAjax_onLoad = loadExhibit;
    window.SimileAjax_urlPrefix = 
"http://static.simile.mit.edu/ajax/api-2.1.0/";;
    
loadJS("http://static.simile.mit.edu/ajax/api-2.1.0/simile-ajax-api.js";);

    function onEverythingLoaded() {
        ... all good here ...
    }

David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to