您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Retrieves the title and icon of a web page and prints them to the console.
// ==UserScript== // @name Get Page Title and Icon // @namespace your-namespace // @version 1.0 // @description Retrieves the title and icon of a web page and prints them to the console. // @author Your Name // @match https://example.com/* // Replace "https://example.com/*" with the URL of the webpage you want to analyze // @grant none // ==/UserScript== (function() { 'use strict'; // Create a new <a> element to extract the page URL var link = document.createElement('a'); link.href = window.location.href; // Retrieve the page title var pageTitle = document.title; // Retrieve the page icon (favicon) var pageIcon = document.querySelector('link[rel="icon"]') || document.querySelector('link[rel="shortcut icon"]') || document.querySelector('link[rel="apple-touch-icon"]'); var pageIconUrl = pageIcon ? pageIcon.href : ''; // Print the page title and icon URL console.log('Page Title: ' + pageTitle); console.log('Page Icon URL: ' + pageIconUrl); })();