背景
今天白天有使用iPad
查看某网页前端代码的需求,在网上找到的几乎千篇一律都是下面这段代码,然而目标站点已经停用了爬取并输出输出前端代码的接口:
javascript:(function()%7Bvar%20d=window.open(%22about:blank%22),a=d.document;a.write(%22%22);a.close();var%20b=a.body.appendChild(a.createElement(%22form%22));b.setAttribute(%22method%22,%22post%22);b.setAttribute(%22action%22,%22http://ole.michelsen.dk/viewsource/?uri=%22+location.href);var%20c=b.appendChild(a.createElement(%22input%22));c.setAttribute(%22type%22,%22hidden%22);c.setAttribute(%22name%22,%22DOM%22);c.setAttribute(%22value%22,encodeURIComponent(document.documentElement.innerHTML));b.submit()%7D)()
记得很久之前找到过一段基于本地的JavaScript
标签代码,从书签栏扒了半天可算是找到了,在博客上放一份以备不时之需:
javascript:(function()%7Bvar%20a=window.open('about:blank').document;a.write('%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3ESource%20of%20'+location.href+'%3C/title%3E%3Cmeta%20name=%22viewport%22%20content=%22width=device-width%22%20/%3E%3C/head%3E%3Cbody%3E%3C/body%3E%3C/html%3E');a.close();var%20b=a.body.appendChild(a.createElement('pre'));b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.appendChild(a.createTextNode(document.documentElement.innerHTML))%7D)();
使用方法
复制代码->保存到一个书签中->在目标页面点击书签
其他情况
经测试Windows
系统Chrome
浏览器也能正常使用。
补充资料
电影接口可用:
javascript:window.location = 'http://xxx.com/?xx='+window.location.href
版权属于:soarli
本文链接:https://blog.soarli.top/archives/558.html
转载时须注明出处及本声明。