本帖最后由 CrLf 于 2015-2-26 15:45 编辑
写这么长是为了消除 cookie 提示- <!--
- 复制网址,再双击此文件即可复制文本到剪贴板,示例网址:
- http://www.hgamecn.com/htmldata/article/2734.html
- -->
-
- <HTA:APPLICATION WINDOWSTATE="minimize" SHOWINTASKBAR="no"/>
-
- <iframe id=copyhtml onload="copyhtml(this)"></iframe>
-
- <script>
- var ws=new ActiveXObject('WScript.Shell')
- username = ws.ExpandEnvironmentStrings('%username%')
- //取得用户名
-
- var sSID = getssid(username)
- //取得ssid
-
- var name = 'HKEY_USERS\\'+sSID+'\\'+
- 'Software\\Microsoft\\Windows\\CurrentVersion\\'+
- 'Internet Settings\\Zones\\3\\1A10'
- //取得注册表地址
-
- var bak = readreg(name)
- //备份注册表信息
-
- writereg(name,0)
- //改写注册表信息,以避免 cookie 提示
-
- var url = clipboardData.getData("text")
- //取得剪贴板中的网址
-
- document.getElementById('copyhtml').src = url
- //将 iframe 指向该网址
-
- window.onbeforeunload = function(){
- writereg(name,bak)
- //结束时还原注册表信息
- }
-
- setTimeout(close,15000)
- //15秒后一定会关闭并触发 onbeforeunload
-
- function getssid(username){
- var wbemServices = GetObject('winmgmts:\\\\.')
- var wbemObjectSet = wbemServices.execquery("select sid from win32_userAccount where name='"+username+"'")
- var sSID = wbemObjectSet.ItemIndex(0).sid
- return sSID
- }
-
- function readreg(name){
- var ws = new ActiveXObject('WScript.Shell')
- return ws.RegRead(name)
- }
-
- function writereg(name,value){
- var ws = new ActiveXObject('WScript.Shell')
- return ws.RegWrite(name,value)
- }
-
- function copyhtml(iframe){
- clipboardData.setData('text',iframe.contentWindow.document.documentElement.innerText)
- //将网页内容保存到剪贴板
-
- close()
- //关闭窗口
- }
- </script>
复制代码
|