简化验证网站所有权的方法(使用javascript?) [英] Streamlined way to validate website ownership (with javascript?)

查看:87
本文介绍了简化验证网站所有权的方法(使用javascript?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rails应用程序,要求用户在从该网站提交链接之前验证他们是否拥有网站。

I have a rails app which requires users to verify that they own a website before submitting links from that site.

我已经实施了一个有效的网站验证系统给几个月前提出的问题的答案。该系统有效但对用户来说相当麻烦。它要求他们在网站上创建一个网页,其中包含网址的特定验证密钥。我觉得我要求用户跳过很多箍只是为了将他们的页面提交到我的网站。然而,网站验证至关重要,我无法放弃这个功能,无论多么麻烦。

I have implemented a website verification system that works thanks to the answers given to a question I made several months ago. This system works but it is rather cumbersome for users. It requires them to create a web page on their site with a specific verification key for a url. I feel like I'm asking the user to jump through a lot of hoops just to submit their pages to my site. Site verification is vital, however, and I can't let go of this feature, however cumbersome.

我正在寻找一些有助于验证网站的JavaScript代码。当用户安装插件时,他们所要做的就是点击Web应用程序上的验证,并为他们完成所有工作。他们不必经历创建新网页并删除它的繁琐工作。

I'm looking to create some javascript code that will help validate websites. When users install the plugin, all they would then have to do is click "verify" on the web app, and all the work is done for them. They don't have to go through the chore of creating a new web page and deleting it.

我对如何开始有一个微弱的想法...

I have a faint idea of how to get started...

第一步:放置在网站上的javascript代码(谷歌分析代码的简化版):

Step one: the javascript code to be placed on the website (simplified version of 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>"

在第二个脚本(verify.js)中:

In the second script(verify.js):

//find some way to ensure that the first script has an id of "VERIFICATION KEY"
//if so, return some data that the rails app can understand and verify the site

任何想法?

推荐答案

还有其他方法来验证网站的所有权。许多公司都会向该域名的注册人发送电子邮件。创建具有特定名称的文件。将一段特定文本放入索引页面的标题中。我认为你在上面尝试的方式比它需要的更复杂。任何网站管理员都可以轻松创建具有特定名称和特定内容的文件。我已经为不同的工具做了很多次。

There are other ways to verify ownership of website. Many companies will send an e-mail to the registrant of the domain. Create a file with a certain name. Put a piece of specific text into the header of the index page. I think the way you're attempting above is more complex than it needs to be. It's pretty easy for any webmaster to create a file with a certain name and with certain content. I've done it many times for different tools.

不要出汗: - )

这篇关于简化验证网站所有权的方法(使用javascript?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆