2150 |
mathias |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<script language="JavaScript" type="text/javascript">
|
|
|
4 |
// Dojo configuration
|
|
|
5 |
djConfig = {
|
|
|
6 |
//debugAtAllCosts: true, //Don't normally need this in applications.
|
|
|
7 |
isDebug: true,
|
|
|
8 |
dojoIframeHistoryUrl: "../../resources/iframe_history.html", //for xdomain
|
|
|
9 |
preventBackButtonFix: false
|
|
|
10 |
};
|
|
|
11 |
</script>
|
|
|
12 |
<script type="text/javascript"
|
|
|
13 |
src="../dojo.js"
|
|
|
14 |
djConfig="isDebug:true, dojoIframeHistoryUrl: '../resources/iframe_history.html'"></script>
|
|
|
15 |
<script type="text/javascript" src="../back.js"></script>
|
|
|
16 |
<script type="text/javascript">
|
|
|
17 |
ApplicationState = function(stateData, outputDivId, backForwardOutputDivId, bookmarkValue){
|
|
|
18 |
this.stateData = stateData;
|
|
|
19 |
this.outputDivId = outputDivId;
|
|
|
20 |
this.backForwardOutputDivId = backForwardOutputDivId;
|
|
|
21 |
this.changeUrl = bookmarkValue || false;
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
dojo.extend(ApplicationState, {
|
|
|
25 |
back: function(){
|
|
|
26 |
this.showBackForwardMessage("BACK for State Data: " + this.stateData);
|
|
|
27 |
this.showStateData();
|
|
|
28 |
},
|
|
|
29 |
forward: function(){
|
|
|
30 |
this.showBackForwardMessage("FORWARD for State Data: " + this.stateData);
|
|
|
31 |
this.showStateData();
|
|
|
32 |
},
|
|
|
33 |
showStateData: function(){
|
|
|
34 |
dojo.byId(this.outputDivId).innerHTML += this.stateData + '<br />';
|
|
|
35 |
},
|
|
|
36 |
showBackForwardMessage: function(message){
|
|
|
37 |
dojo.byId(this.backForwardOutputDivId).innerHTML += message + '<br />';
|
|
|
38 |
}
|
|
|
39 |
});
|
|
|
40 |
|
|
|
41 |
var data = {
|
|
|
42 |
link0: "This is the initial state (page first loaded)",
|
|
|
43 |
"link with spaces": "This is data for a state with spaces",
|
|
|
44 |
"link%20with%20encoded": "This is data for a state with encoded bits",
|
|
|
45 |
"link+with+pluses": "This is data for a state with pluses",
|
|
|
46 |
link1: "This is data for link 1",
|
|
|
47 |
link2: "This is data for link 2",
|
|
|
48 |
link3: "This is data for link 3",
|
|
|
49 |
link4: "This is data for link 4",
|
|
|
50 |
link5: "This is data for link 5",
|
|
|
51 |
link6: "This is data for link 6",
|
|
|
52 |
link7: "This is data for link 7"
|
|
|
53 |
};
|
|
|
54 |
|
|
|
55 |
function goNav(id){
|
|
|
56 |
var appState = new ApplicationState(data[id], "output", "dataOutput", id);
|
|
|
57 |
appState.showStateData();
|
|
|
58 |
dojo.back.addToHistory(appState);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
dojo.addOnLoad(function(){
|
|
|
62 |
var appState = new ApplicationState(data["link0"], "output", "dataOutput");
|
|
|
63 |
appState.showStateData();
|
|
|
64 |
dojo.back.setInitialState(appState);
|
|
|
65 |
});
|
|
|
66 |
</script>
|
|
|
67 |
</head>
|
|
|
68 |
<body>
|
|
|
69 |
<script type="text/javascript">dojo.back.init();</script>
|
|
|
70 |
<div style="padding-bottom: 20px; width: 100%; border-bottom: 1px solid gray">
|
|
|
71 |
<h3>dojo.back test</h3>
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
<p>This page tests the dojo.back back/forward code. It <b>does not</b>
|
|
|
75 |
use the bookmarking facility of dojo.back. For that test,
|
|
|
76 |
see <a href="back-bookmark.html">back-bookmark.html</a>.</p>
|
|
|
77 |
|
|
|
78 |
<p>The buttons that start with "Link" on them don't use any dojo.xhr* calls,
|
|
|
79 |
just JS data already in the page.</p>
|
|
|
80 |
|
|
|
81 |
<ul>
|
|
|
82 |
<li>Don't test this page using local disk for MSIE. MSIE will not
|
|
|
83 |
create a history list for iframe_history.html if served from a file:
|
|
|
84 |
URL. Serve the test pages from a web server to test in that browser.</li>
|
|
|
85 |
<li>Safari 2.0.3+ (and probably 1.3.2+): Only the back button works OK
|
|
|
86 |
(not the forward button).</li>
|
|
|
87 |
<li>Opera 8.5.3: Does not work.</li>
|
|
|
88 |
<li>Konqueror: Unknown. The latest may have Safari's behavior.</li>
|
|
|
89 |
</ul>
|
|
|
90 |
</div>
|
|
|
91 |
<div style="float:left; padding: 20px">
|
|
|
92 |
<button onclick="goNav('link1')">Link 1</button><br />
|
|
|
93 |
<button onclick="goNav('link with spaces')">Link with Spaces</button><br />
|
|
|
94 |
<button onclick="goNav('link%20with%20encoded')">Link with Encoded</button><br />
|
|
|
95 |
<button onclick="goNav('link+with+pluses')">Link with Pluses</button><br />
|
|
|
96 |
<button onclick="goNav('link3')">Link 3</button><br />
|
|
|
97 |
<button onclick="goNav('link4')">Link 4</button><br />
|
|
|
98 |
<button onclick="goNav('link5')">Link 5</button><br />
|
|
|
99 |
<button onclick="goNav('link6')">Link 6</button><br />
|
|
|
100 |
<button onclick="goNav('link7')">Link 7</button><br />
|
|
|
101 |
</div>
|
|
|
102 |
<div style="float: left; padding: 20px">
|
|
|
103 |
<b>Data Output:</b><br />
|
|
|
104 |
<div id="output"></div>
|
|
|
105 |
<hr />
|
|
|
106 |
<i>Back/Forward Info:</i><br />
|
|
|
107 |
<div id="dataOutput"></div>
|
|
|
108 |
</div>
|
|
|
109 |
</body>
|
|
|
110 |
</html>
|