在 Android 上激活 Firefox 中的 reader 模式的书签
Bookmarklet to activate reader mode in Firefox on Android
最近 Firefox 在 Android 上发生了变化,这使我无法使用将内容添加到我的阅读列表并从那里打开它以强制页面进入 reader 模式的变通方法。考虑到这一点,我试图找到并最终制作一个小书签来强制页面进入 reader 模式。
到目前为止,我发现通过将 'about:reader?url=' 添加到 url 的开头,将尝试以 reader 模式打开任何页面。由于对 javascript 了解不多,我尝试使用我在网上找到的其他示例来总结一些东西。首先,我只是想出了如何添加到 url 并且能够让它工作
javascript: window.location = window.location + 'about:reader?url=';
上面的内容可以很好地添加到结尾,但是当我将它移到开头时它不再有效所以当我尝试时
javascript: window.location = 'about:reader?url=' + window.location;
即使在只允许 reader 模式的页面上也没有任何反应。当我用 'test' 替换我添加的内容时,尽管它会很高兴地导致页面转到 'testhttp://www.google.com/' 或其他任何地方。我不仅在我的 android phone 上尝试过,还在我的桌面上尝试过。据我所知,我做错了什么?
几乎可以肯定,Firefox 认为允许 Javascript 将页面更改为以 about:
开头的任何位置是一种安全风险。
在 Windows 中使用 Firefox 中的 Javascript 控制台到 运行 此代码:
window.location = 'about:reader?url=' + window.location;
returns 错误:
Access to 'about:reader?url=...' from script denied
这里有一个 "work around" 可以减轻您的特殊痛苦:
javascript:(function(){prompt('Copy the below text and then paste it into the URL bar:', 'about:reader?url='+encodeURIComponent(document.location))})();
它会提示您 url 您可以复制然后粘贴到 URL 栏中。
最近 Firefox 在 Android 上发生了变化,这使我无法使用将内容添加到我的阅读列表并从那里打开它以强制页面进入 reader 模式的变通方法。考虑到这一点,我试图找到并最终制作一个小书签来强制页面进入 reader 模式。
到目前为止,我发现通过将 'about:reader?url=' 添加到 url 的开头,将尝试以 reader 模式打开任何页面。由于对 javascript 了解不多,我尝试使用我在网上找到的其他示例来总结一些东西。首先,我只是想出了如何添加到 url 并且能够让它工作
javascript: window.location = window.location + 'about:reader?url=';
上面的内容可以很好地添加到结尾,但是当我将它移到开头时它不再有效所以当我尝试时
javascript: window.location = 'about:reader?url=' + window.location;
即使在只允许 reader 模式的页面上也没有任何反应。当我用 'test' 替换我添加的内容时,尽管它会很高兴地导致页面转到 'testhttp://www.google.com/' 或其他任何地方。我不仅在我的 android phone 上尝试过,还在我的桌面上尝试过。据我所知,我做错了什么?
几乎可以肯定,Firefox 认为允许 Javascript 将页面更改为以 about:
开头的任何位置是一种安全风险。
在 Windows 中使用 Firefox 中的 Javascript 控制台到 运行 此代码:
window.location = 'about:reader?url=' + window.location;
returns 错误:
Access to 'about:reader?url=...' from script denied
这里有一个 "work around" 可以减轻您的特殊痛苦:
javascript:(function(){prompt('Copy the below text and then paste it into the URL bar:', 'about:reader?url='+encodeURIComponent(document.location))})();
它会提示您 url 您可以复制然后粘贴到 URL 栏中。