2012-06-03 119 views
0

有沒有辦法模擬「鏈接附加」行爲發生在大多數社交網站,如linkedin,Facebook或谷歌加嗎?例如, enter image description here附加鏈接像在谷歌加或鏈接在asp.net或jquery

當我發佈網址時,會自動提取內容和縮略圖。這是如何發生的?有沒有辦法用jQuery來做到這一點?

感謝

+0

可能有幾種方法來實現這一目標進行渲染。你試過什麼了? – lucuma

+0

因爲JavaScript無法對外部URL執行GET操作,所以在服務器端需要一些東西。基本上你需要一個PHP頁面來對鏈接做一個cURL請求,把文章主體的前500個字符拉回頁面,並製作圖像集合。 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/352867/">roryok</a></span> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>可以使用AJAX或得到jQuery的回報叫你應該得到的HTML頁面,你可以根據自己的需要</p> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/11761912">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2012-08-01 14:54:23</span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-sdrslmyh-xc.html" target="_blank" title="jquery谷歌鏈接"> jquery谷歌鏈接 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-xxxnfxrh-vh.html" target="_blank" title="替換或附加到鏈接"> 替換或附加到鏈接 </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-tvrnucaa-bap.html" target="_blank" title="附加鏈接"> 附加鏈接 </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-njzlgpub-rx.html" target="_blank" title="鏈接jQuery的附加"> 鏈接jQuery的附加 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-ecciigni-bnu.html" target="_blank" title="附加到jQuery的鏈接"> 附加到jQuery的鏈接 </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-taphklfc-bao.html" target="_blank" title="Google附加鏈接"> Google附加鏈接 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-xjxvmnuo-gc.html" target="_blank" title="如何預加載圖像從一個鏈接在PHP或jquery"> 如何預加載圖像從一個鏈接在PHP或jquery </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-vbxdgndd-er.html" target="_blank" title="在谷歌加分享圖像和鏈接"> 在谷歌加分享圖像和鏈接 </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-dpaunhxv-up.html" target="_blank" title="添加搜索鏈接谷歌的Sitemaps"> 添加搜索鏈接谷歌的Sitemaps </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-gmiumibk-eo.html" target="_blank" title="谷歌加鏈接共享問題"> 谷歌加鏈接共享問題 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-fivxiink-bcu.html" target="_blank" title="谷歌加sdk鏈接器錯誤ios"> 谷歌加sdk鏈接器錯誤ios </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-hqjslfvq-bem.html" target="_blank" title="ASP.net添加鏈接"> ASP.net添加鏈接 </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-aaopidey-bnn.html" target="_blank" title="谷歌的鏈接附加index.php到我的網址"> 谷歌的鏈接附加index.php到我的網址 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-urbfaqip-qo.html" target="_blank" title="Jquery附加鏈接(鏈接'點擊'不起作用)"> Jquery附加鏈接(鏈接'點擊'不起作用) </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-pfccrdwb-xp.html" target="_blank" title="libjvm.so:鏈接或不鏈接?"> libjvm.so:鏈接或不鏈接? </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-slqiqbge-bmt.html" target="_blank" title="超鏈接或在DevExpress上的PivotGridField上的鏈接 - ASP.NET與C#"> 超鏈接或在DevExpress上的PivotGridField上的鏈接 - ASP.NET與C# </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-nazhvqlo-bkp.html" target="_blank" title="jQuery:停止onclick循環附加鏈接"> jQuery:停止onclick循環附加鏈接 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-xwrsjmeq-bhw.html" target="_blank" title="使用jquery將鏈接附加到div"> 使用jquery將鏈接附加到div </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-ykakilel-kx.html" target="_blank" title="帆布jQuery的附加鏈接A HREF"> 帆布jQuery的附加鏈接A HREF </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-mdivtlhn-za.html" target="_blank" title="附加JQuery點擊功能鏈接類"> 附加JQuery點擊功能鏈接類 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-oawxjlvo-bkr.html" target="_blank" title="用jQuery選擇附加鏈接按鈕"> 用jQuery選擇附加鏈接按鈕 </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-cdhtrvyb-dz.html" target="_blank" title="shouldStartLoadWithRequest附加鏈接與applewebdata"> shouldStartLoadWithRequest附加鏈接與applewebdata </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-muoydjea-tr.html" target="_blank" title="附加圖標鏈接MuPDF"> 附加圖標鏈接MuPDF </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-eaamkkzg-ua.html" target="_blank" title="Javascript附加鏈接複製"> Javascript附加鏈接複製 </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-wcijlprw-bdh.html" target="_blank" title="添加圖像作爲附加鏈接在帖子主題"> 添加圖像作爲附加鏈接在帖子主題 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-exfpcucn-bhe.html" target="_blank" title="在懸停鏈接或文本上顯示谷歌地圖"> 在懸停鏈接或文本上顯示谷歌地圖 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-wnzjxodm-bgp.html" target="_blank" title="在iframe中的鏈接附加父URL"> 在iframe中的鏈接附加父URL </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-sblrjqry-ku.html" target="_blank" title="附加到分頁鏈接URL在Laravel"> 附加到分頁鏈接URL在Laravel </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-zwlyvkmj-kw.html" target="_blank" title="禁止在拖動圖像或鏈接"> 禁止在拖動圖像或鏈接 </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-wahhtkpp-da.html" target="_blank" title="在jquery進度條的末尾加載div或href鏈接"> 在jquery進度條的末尾加載div或href鏈接 </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-uazvoukg-tn.html" target="_blank" title="Python的正則表達式:從一個字符串"> Python的正則表達式:從一個字符串 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-bfrziydq-py.html" target="_blank" title="分享偏好來保存個人資料圖片"> 分享偏好來保存個人資料圖片 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-tgbqscms-qh.html" target="_blank" title="有沒有辦法編寫一個函數,使用HttpServletRequest獲取IP地址而不將其作爲參數傳遞?"> 有沒有辦法編寫一個函數,使用HttpServletRequest獲取IP地址而不將其作爲參數傳遞? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-sqerijvi-qt.html" target="_blank" title="如何測試處理ImportErrors的代碼?"> 如何測試處理ImportErrors的代碼? </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-rxiccvgv-rc.html" target="_blank" title="矩陣包中的提取速度與常規矩陣類相比非常緩慢"> 矩陣包中的提取速度與常規矩陣類相比非常緩慢 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-oxftnqwz-ro.html" target="_blank" title="pics not in codeignitor"> pics not in codeignitor </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-bndlqtaj-rx.html" target="_blank" title="特殊按鈕形狀(稍微旋轉箭頭)"> 特殊按鈕形狀(稍微旋轉箭頭) </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-ahxwsfxs-pp.html" target="_blank" title="emacs elisp切換到緩衝區,並按照"> emacs elisp切換到緩衝區,並按照 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-ylozrydp-ou.html" target="_blank" title="正在返回什麼以及本文檔中描述的功能正在採取什麼措施?"> 正在返回什麼以及本文檔中描述的功能正在採取什麼措施? </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-eoouwcdf-pd.html" target="_blank" title="MySQL數據庫 - 字符集和歸類轉換爲utf8mb4和utf8mb4_unicode_ci?"> MySQL數據庫 - 字符集和歸類轉換爲utf8mb4和utf8mb4_unicode_ci? </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-sdrslmyh-xc.html" target="_blank" title="jquery谷歌鏈接"> jquery谷歌鏈接 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-xxxnfxrh-vh.html" target="_blank" title="替換或附加到鏈接"> 替換或附加到鏈接 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-tvrnucaa-bap.html" target="_blank" title="附加鏈接"> 附加鏈接 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-njzlgpub-rx.html" target="_blank" title="鏈接jQuery的附加"> 鏈接jQuery的附加 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-ecciigni-bnu.html" target="_blank" title="附加到jQuery的鏈接"> 附加到jQuery的鏈接 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-taphklfc-bao.html" target="_blank" title="Google附加鏈接"> Google附加鏈接 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-xjxvmnuo-gc.html" target="_blank" title="如何預加載圖像從一個鏈接在PHP或jquery"> 如何預加載圖像從一個鏈接在PHP或jquery </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-vbxdgndd-er.html" target="_blank" title="在谷歌加分享圖像和鏈接"> 在谷歌加分享圖像和鏈接 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-dpaunhxv-up.html" target="_blank" title="添加搜索鏈接谷歌的Sitemaps"> 添加搜索鏈接谷歌的Sitemaps </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-gmiumibk-eo.html" target="_blank" title="谷歌加鏈接共享問題"> 谷歌加鏈接共享問題 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>