dquv73115 2011-07-12 17:56
浏览 51
已采纳

以编程方式检查远程网站“显示”特定的html元素

I want to require my free users to add a linkback to my website. But, I want to check it programmatically that indeed they added the linkback html element I provided and was not hidden by some sort of CSS and Javascript.

Any good suggestions?

  • 写回答

2条回答 默认 最新

  • dtutlamjasblef7982 2011-07-12 18:08
    关注

    Not an expert on this matter but I'd say the easiest and most reliable method involves actually rendering their page in a browser to ensure that all CSS and JavaScript is applied in the same way a user would see.

    Obviously you don't want to do this yourself, but I assume your site has a page where users tell you that they've added the link to it, or where they request free usage based on that link. At this point you could load their page into a hidden IFrame then use JavaScript (JQuery would undoubtedly be easiest) to find your link and query its visibility.

    This may be complicated by cross-domain security issues (accessing the IFrame's content) but a proxy on your server could easily work around this.

    Without using a browser and JavaScript I can imagine it would be a huge job to parse their HTML, CSS and JavaScript server-side and look for any hint that your link isn't visible - as there are plenty of ways it could be hidden (even by accident).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序