"View Generated Source" AppleScript for Safari.

23 views
Skip to first unread message

gugod

unread,
Dec 25, 2006, 9:19:26 AM12/25/06
to hsinchu.js
參考自
http://www.ditchnet.org/wp/2005/09/07/view-generated-source-in-bbedit-for-safari/

提供一個在 Safari 環境中查看目前 HTML
原始碼的方式。原文使用的是
BBEdit,不過,稍為改一下,也可以使用
TextEdit。以下這段程式碼,可存在

~/Library/Scripts/Applications/Safari

便可從 Scripts Menu 執行,相當方便。

---8<---
global jsCode
global htmlSource

set jsCode to "document.documentElement.outerHTML"

tell application "Safari"
set htmlSource to (do JavaScript jsCode in front document)
end tell

tell application "TextEdit"
activate
make new document
set text of front document to htmlSource
end tell
--->8---

Reply all
Reply to author
Forward
0 new messages