Site Notice

hello, world

Difference between revisions of "Short url"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
([InPageEdit] 没有编辑摘要 (历史版本:1102))
Line 6: Line 6:
 
<div id="tencent">
 
<div id="tencent">
 
<pre class="urlFinal">https://url.cn/</pre>
 
<pre class="urlFinal">https://url.cn/</pre>
<input placeholder="https://wjghj.cn" value="https://wjghj.cn" class="urlRequest"/> <button onclick="getTencent()">生成</button>
+
<input placeholder="https://wjghj.cn" class="urlRequest"/> <button onclick="getTencent()">生成</button>
 
<script>
 
<script>
 
function getTencent() {
 
function getTencent() {
   if ($('#tc-s-url').length > 0) {
+
   $.ajax({
     console.info('请求频次太快!');
+
     url: 'https://doc.wjghj.cn/surl/?url='+$('#tencent .urlRequest').val(),
    return;
+
     dataType: 'jsonp',
  }
+
     type: 'get',
  $('body').append('<iframe id="tc-s-url" style="display:none" src="https://sa.sogou.com/gettiny?url=' + $('#tencent .urlRequest').val() + '" sandbox="allow-same-origin allow-scripts"></iframe>');
+
     success: function(data) {
  $('#tc-s-url').load(function () {
+
       $('#tencent .urlFinal').html(data.short_url);
     var url = $('#tc-s-url').contents().find('body').text();
+
     }
     $('#tencent .urlFinal').html(url);
 
     /*setTimeout(function () {
 
       $('#tc-s-url').remove();
 
     }, 5000);*/
 
 
   });
 
   });
 
}
 
}
</script>
+
</sctipt>
 
</html>
 
</html>

Revision as of 01:46, 22 November 2019

此页收集一些短网址生成api

腾讯

  • url.cn

<html> <div id="tencent"> <pre class="urlFinal">https://url.cn/</pre> <input placeholder="https://wjghj.cn" class="urlRequest"/> <button onclick="getTencent()">生成</button> <script> function getTencent() {

 $.ajax({
   url: 'https://doc.wjghj.cn/surl/?url='+$('#tencent .urlRequest').val(),
   dataType: 'jsonp',
   type: 'get',
   success: function(data) {
     $('#tencent .urlFinal').html(data.short_url);
   }
 });

} </sctipt> </html>