root / trunk / iframe_history.html

Revision 6981, 2.3 kB (checked in by jburke, 23 months ago)

Fixes #2274: allow modules that use iframes to have djConfig overrides to specify local file paths. Also made it so that if using iframe_history.html, you can pass init args via fragment identifiers so iframe_history.html can be more easily cached.

  • Property svn:eol-style set to native
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6        <title></title>
7        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
8        <script type="text/javascript">
9        // <!--
10        var noInit = false;
11        var domain = "";
12        // document.domain = "localhost";
13       
14        function defineParams(sparams){
15                if(sparams){
16                        var ss = (sparams.indexOf("&amp;") >= 0) ? "&amp;" : "&";
17                        sparams = sparams.split(ss);
18                        for(var x=0; x<sparams.length; x++){
19                                var tp = sparams[x].split("=");
20                                if(typeof window[tp[0]] != "undefined"){
21                                        window[tp[0]] = ((tp[1]=="true")||(tp[1]=="false")) ? eval(tp[1]) : tp[1];
22                                }
23                        }
24                }
25        }
26       
27        function init(){
28                // parse the query string if there is one to try to get params that
29                // we can act on. Also allow params to be in a fragment identifier.
30                var query = null;
31                var frag = null;
32                var url = document.location.href;
33                var hashIndex = url.indexOf("#");
34               
35                //Extract fragment identifier
36                if(hashIndex != -1){
37                        frag = url.substring(hashIndex + 1, url.length);
38                        url = url.substring(0, hashIndex);
39                }
40
41                //Extract querystring
42                var parts = url.split("?");
43                if(parts.length == 2){
44                        query = parts[1];
45                }
46
47                defineParams(query);
48                defineParams(frag);
49
50                if(noInit){ return; }
51                if(domain.length > 0){
52                        document.domain = domain;
53                }
54                var hasParentDojo = false;
55                try{
56                        hasParentDojo = window.parent != window && window.parent["dojo"];
57                }catch(e){
58                        alert("Initializing iframe_history.html failed. If you are using a cross-domain Dojo build,"
59                                + " please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl"
60                                + " to the path on your domain to iframe_history.html");
61                        throw e;
62                }
63
64                if(hasParentDojo){
65                        //Set the page title so IE history shows up with a somewhat correct name.
66                        document.title = window.parent.document.title;
67                       
68                        //Notify parent that we are loaded.
69                        var pdj = window.parent.dojo;
70                        if(pdj["undo"] && pdj["undo"]["browser"]){
71                                pdj.undo.browser.iframeLoaded(null, window.location);
72                        }
73                }
74
75        }
76        // -->
77        </script>
78</head>
79<body onload="try{ init(); }catch(e){ alert(e); }">
80        <h4>The Dojo Toolkit -- iframe_history.html</h4>
81
82        <p>This file is used in Dojo's back/fwd button management.</p>
83</body>
84</html>
Note: See TracBrowser for help on using the browser.