Advertisement
Infra_HDC

dojo history integration

Dec 7th, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.71 KB | None | 0 0
  1. <head>
  2.          <title>Fun with Back!</title>
  3.  
  4.  
  5.         <link rel="stylesheet" type="text/css"
  6.          href="http://o.aolcdn.com/dojo/1.1/dojo/resources/dojo.css" />
  7.  
  8.  
  9.          <script
  10.             type="text/javascript"
  11.             src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js"
  12.             djConfig="dojoIframeHistoryUrl:'iframe_history.html',isDebug:true"
  13.         ></script>
  14.  
  15.          <script type="text/javascript">
  16.  
  17.              dojo.addOnLoad(function(  ) {
  18.                 initialState = {
  19.                     back: function(  ) { console.log("Back to initial state"); }
  20.                 };
  21.  
  22.                 //set the initial state and move forward two steps in history
  23.                 dojo.back.setInitialState(initialState);
  24.                 i=1;
  25.                 dojo.back.addToHistory({
  26.                     back: function(  ) { console.log("Back to state "+this.changeUrl); },
  27.                     forward: function(  ) { console.log("Forward to state "+this.changeUrl); },
  28.                     changeUrl : 'state'+i
  29.                 });
  30.                 i++;
  31.                 dojo.back.addToHistory({
  32.                     back: function(  ) { console.log("Back to state "+this.changeUrl); },
  33.                     forward: function(  ) { console.log("Forward to state "+this.changeUrl); },
  34.                     changeUrl : 'state'+i
  35.                 });
  36.             });
  37.          </script>
  38.      </head>
  39.         <body>
  40.             <script type="text/javascript"
  41.                src="http://o.aolcdn.com/dojo/1.1/dojo/back.js"></script>
  42.             <script type="text/javascript">dojo.back.init(  );</script>
  43.  
  44.             Press the back button and have a look at the console.
  45.         </body>
  46.  </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement