I have a rails app that requires users to verify that they own a site before posting links from this site.
I have implemented a website verification system that works thanks to the answers to a question I made a few months ago . This system works, but it is rather cumbersome for users. It requires them to create a web page on their site using a specific validation key for the URL. I feel that I am asking the user to jump over a lot of hoops to submit their pages to my site. However, checking the site is vital, and I can not let go of this feature, as it were cumbersome.
I want to create javascript code that will help check websites. When users install the plugin, all they would need to do is click “verify” in the web application, and all the work will be done for them. They do not need to do the work of creating a new web page and deleting it.
I have a faint idea of how to get started ...
Step One: The javascript code to be posted on the website (a simplified version of the Google Analytics code):
"<script type='text/javascript' id="THE VERIFICATION CODE GENERATED BY THE RAILS APP">
(function() {
var secondScript = document.createElement('script');
secondScript.type = 'text/javascript';
secondScript.src = 'http://www.mywebapp.com/verify.js';
var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(secondScript, firstScript);
})();
</script>"
In the second script (verify.js):
Any ideas?
source
share