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

Untitled

By: a guest on Jun 11th, 2012  |  syntax: None  |  size: 2.38 KB  |  hits: 23  |  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. returning undefined in bookmarklet - forwards page
  2. javascript:void((function(){
  3. var s = document.createElement('script');
  4. s.setAttribute('language','javascript');
  5. s.setAttribute('src','http://localhost:3000/script/bookmarklet.js');
  6. document.body.appendChild(s);
  7. })());
  8.        
  9. javascript:(function(){
  10. var s = document.createElement('script');
  11. s.setAttribute('language','javascript');
  12. s.setAttribute('src','http://localhost:3000/script/bookmarklet.js');
  13. document.body.appendChild(s);
  14. void(0);
  15. })();
  16.        
  17. (function() {
  18.  
  19. function create_form() {
  20.     var path = "http://localhost:3000/links";
  21.  
  22.     var newform = document.createElement('form');
  23.     newform.setAttribute("method", "post");
  24.     newform.setAttribute("action", path);
  25.     newform.setAttribute("accept-charset","UTF-8");
  26.  
  27.     var title_hidden_field = document.createElement("input");
  28.     title_hidden_field.setAttribute("type","hidden");
  29.     title_hidden_field.setAttribute("name", "link[title]");
  30.     title_hidden_field.setAttribute("value", "Test Title");
  31.  
  32.     newform.appendChild(title_hidden_field);
  33.  
  34.     var url_hidden_field = document.createElement("input");
  35.     url_hidden_field.setAttribute("type","hidden");
  36.     url_hidden_field.setAttribute("name", "link[url]");
  37.     url_hidden_field.setAttribute("value", "http://www.example.com");
  38.  
  39.     newform.appendChild(url_hidden_field);
  40.  
  41.     document.body.appendChild(newform);
  42.     newform.submit();
  43. };
  44.  
  45. create_form();
  46. })();
  47.        
  48. var myiframe = document.createElement('iframe');
  49. myiframe.scrolling = "no";
  50. myiframe.name = "myiframe";
  51. myiframe.id = "myiframe";
  52. myiframe.src = "blank.html"; //so your users wont have to use their bandwith much, I think you can also set it to the about page in many browsers
  53. myiframe.width = "0px"; //so it becomes invisible
  54. myiframe.height = "0px"; //""
  55. document.body.appendChild(myiframe)
  56.        
  57. var ThisBody = document.body.innerHTML
  58. ThisBody += '<iframe frameborder="0" scrolling="no" name="myiframe" id="myiframe" src="blank.html" width="0px" height="0px"></iframe>
  59.        
  60. newform.target = "document.getElementById('myiframe')" //our iframe
  61.        
  62. javascript:(function(){
  63. var s = document.createElement('script');
  64. s.setAttribute('language','javascript');
  65. s.setAttribute('src','http://localhost:3000/script/bookmarklet.js');
  66. document.body.appendChild(s);
  67. })();void(0)
  68.        
  69. newform.onsubmit = function(event) {
  70.         event.preventDefault();
  71.         // Create XMLHttpRequest object and send data.
  72.     }