Sorta喜欢 当您单击该按钮时,您将从链接中获取favicon.ico(使用js) 示例ico将是stackoverflow favicon
//this is the js section
//some way to read the text box and Retrieve favicon from link

<button Id=button Onclick=<!--add Update favicon function here -->
Favicon.ico</button>
<input type=box id=field text="input Text here">
&#13;
答案 0 :(得分:0)
如果我理解你的要求正确,这应该有效:
function updateFavicon(link){
let exists = $("link[rel*='icon']");
if(exists.length){
$("link[rel*='icon']").attr('href', link);
} else {
$("head").append("<link rel='icon' href='" + link + "'>");
}
}
然后:
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div>
<input type="text" id="link">
<button onclick="updateFavicon($('#link').val())">Update Favicon</button>
</div>