Created
          November 14, 2017 01:47 
        
      - 
      
 - 
        
Save colleowino/69ee6dd39680bbc3b74e481f559d7561 to your computer and use it in GitHub Desktop.  
    Creating Dom element and adding it to the document
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | document.addEventListener('DOMContentLoaded', function() { | |
| var checkPageButton = document.getElementById('checkPage'); | |
| checkPageButton.addEventListener('click', function() { | |
| chrome.tabs.getSelected(null, function(tab) { | |
| d = document; | |
| var f = d.createElement('form'); | |
| f.action = 'http://gtmetrix.com/analyze.html?bm'; | |
| f.method = 'post'; | |
| var i = d.createElement('input'); | |
| i.type = 'hidden'; | |
| i.name = 'url'; | |
| i.value = tab.url; | |
| f.appendChild(i); | |
| d.body.appendChild(f); | |
| f.submit(); | |
| }); | |
| }, false); | |
| }, false); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment