No-frills light-weight Android web browser with support for Greasemonkey userscripts.
Builds upon the WebView GM library demo application.
*.user.js
URLsGM_addStyle
GM_deleteValue
GM_getResourceText
GM_getResourceURL
GM_getValue
GM_listValues
GM_log
GM_setValue
GM_xmlhttpRequest
GM_addElement
GM_cookie.delete
GM_cookie.list
GM_cookie.set
GM_fetch
window.fetch
that uses GM_xmlhttpRequest
to make network requestsGM_info
GM_registerMenuCommand
GM_unregisterMenuCommand
GM.addElement
GM.addStyle
GM.cookie.delete
GM.cookie.list
GM.cookie.set
GM.cookies.delete
GM.cookies.list
GM.cookies.set
GM.deleteValue
GM.fetch
GM.getResourceText
GM.getResourceUrl
GM.getValue
GM.info
GM.listValues
GM.log
GM.registerMenuCommand
GM.setValue
GM.unregisterMenuCommand
GM.xmlHttpRequest
GM_exit()
GM_getUrl()
var is_redirect = (GM_getUrl() !== unsafeWindow.location.href)
GM_getUserAgent()
GM_loadFrame(urlFrame, urlParent, proxyFrame)
urlFrame
is a String URL: the page loaded into the iframeurlParent
is a String URL: value for window.top.location.href
and window.parent.location.href
as observed from within the iframeproxyFrame
is a boolean: a truthy value causes urlFrame
to be downloaded in Java
urlParent
is sent in the Referer headerurlParent
and urlFrame
belong to different domains, a userscript running in the top window can access the DOM within the iframe windowurlFrame
only serves the desired web page content if urlParent
is sent in the Referer header('http://example.com/iframe_window.html', 'http://example.com/parent_window.html')
const urlParent = 'http://example.com/parent_window.html'
try {
// will throw when either:
// - `top` is loaded from a different domain
// - `top` is loaded from the same origin, but the URL path does not match 'parent_window.html'
if(window.top.location.href !== urlParent)
throw ''
}
catch(e) {
// will redirect `top` window to the proper parent window
window.top.location = urlParent
}
const urlParent = 'http://example.com/parent_window.html'
{
// will redirect to proper parent window when 'iframe_window.html' is loaded without a `top` window
if(window === window.top)
window.location = urlParent
}
GM_loadUrl(url, ...headers)
url
is a String URLheaders
is a list of String name/value pairs('http://example.com/iframe_window.html', 'Referer', 'http://example.com/parent_window.html')
GM_removeAllCookies()
GM_resolveUrl(urlRelative, urlBase)
urlRelative
resolved relative to urlBase
urlRelative
is a String URL: relative pathurlBase
is a String URL: absolute path
('video.mp4', 'http://example.com/iframe_window.html')
('video.mp4')
GM_setUserAgent(value)
value
is a String
WebView
(or falsy)Chrome
GM_startIntent(action, data, type, ...extras)
action
is a Stringdata
is a String URLtype
is a String mime-type for format of data
extras
is a list of String name/value pairs('android.intent.action.VIEW', 'http://example.com/video.mp4', 'video/mp4', 'referUrl', 'http://example.com/videos.html')
GM_toastLong(message)
GM_toastShort(message)
GM.exit
GM.getUrl
GM.getUserAgent
GM.loadFrame
GM.loadUrl
GM.removeAllCookies
GM.resolveUrl
GM.setUserAgent
GM.startIntent
GM.toastLong
GM.toastShort
0
disables automatic script updateswindow.WebViewWM.getUserscriptJS(secret, url)
adb connect "${IP_of_phone_on_LAN}:5555"
chrome://inspect/#devices
// @unwrap
// @flag noJsClosure
// @flags noJsClosure
window
Object are stored in a sandboxProxy
// @grant none
// @flag noJsSandbox
// @flags noJsSandbox
// @grant <API>
is only required to use API methods that I would consider to be potentially dangerousGM_setValue
GM_getValue
GM_deleteValue
GM_listValues
GM.setValue
GM.getValue
GM.deleteValue
GM.listValues
GM_cookie
GM_cookie.list
GM_cookie.set
GM_cookie.delete
GM.cookie
GM.cookie.list
GM.cookie.set
GM.cookie.delete
GM.cookies
GM.cookies.list
GM.cookies.set
GM.cookies.delete
GM_removeAllCookies
GM.removeAllCookies
GM_setUserAgent
GM.setUserAgent