Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.69 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jquery, save entire DOM for reloading
  2. <!DOCTYPE HTML>
  3. <html lang="en-US">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title></title>
  7.  
  8. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  9. <script type="text/javascript">
  10.  
  11.     $(function(){
  12.  
  13.         var xml = '<?xml version="1.0"?><foo><bar>bar</bar></foo>';
  14.  
  15.         document.open("text/xml", "replace");
  16.         document.write(xml);
  17.  
  18.         document.execCommand('SaveAs',true,'file.xml');
  19.  
  20.     });
  21.  
  22. </script>
  23.  
  24.  </head>
  25. <body>
  26.  
  27. </body>
  28. </html>
  29.        
  30. popup.document.open("text/xml", "replace");
  31.     popup.document.write(xml);
  32.  
  33.     popup.document.execCommand('SaveAs',true,'file.xml');
  34.     popup.close();
  35. });