71c5f087e38342fb6cee2b8e475ea0b0548d4e67.svn-base 4.0 KB

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