Bookmarklet在Android上的Firefox中激活阅读器模式

时间:2016-08-03 19:56:21

标签: javascript android firefox bookmarklet

最近Android上的Firefox发生了变化,这使我无法使用在我的阅读列表中添加内容并从那里打开它以强制页面进入阅读器模式。考虑到这一点,我试图找到,然后最终制作一个书签,以强制页面进入阅读器模式。

到目前为止,我发现通过在url的开头添加'about:reader?url ='会尝试打开任何页面进入阅读器模式。从那里我不太了解javascript我试图用我在网上找到的其他例子来拼凑一些东西。首先,我想出了如何添加到网址并且能够正常工作

<?php

$logfile = fopen("log.txt", "w");
fwrite($logfile, "testing\n");

$method = $_SERVER['REQUEST_METHOD'];
//$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_encode($_GET,true);
$req_dump = print_r( $input, true );

fwrite($logfile, $req_dump . "\n");

fclose($logfile);

以上将添加到最后就好了但是当我把它移到开头时它不再有用,所以当我尝试

javascript: window.location = window.location + 'about:reader?url=';

即使在只允许阅读器模式的页面上也没有任何事情发生。当我更换我正在添加的内容时只是'测试',但它会很高兴地使页面转到'testhttp://www.google.com/'或其他任何地方。我不仅尝试了我的Android手机,还尝试了我的桌面。从我能看到的这应该有用,我做错了什么?

1 个答案:

答案 0 :(得分:0)

Firefox几乎肯定认为允许Javascript将页面更改为以def myModelOutput(...): # ... sess = tf.Session() # ... # Convert the `tf.Variable` objects `W` and `b` to NumPy arrays. W_val, b_val = sess.run([W, b]) sess.close() # Assumes `sess` is local to the function. return {'W': W_val, 'b': b_val} 开头的任何位置存在安全风险。

使用Windows中的Firefox中的Javascript控制台运行此代码:

about:

返回错误:

window.location = 'about:reader?url=' + window.location;

这是一个&#34;解决方案&#34;这可能会减轻你的痛苦:

Access to 'about:reader?url=...' from script denied

它会提示您提供一个可以复制的网址,然后粘贴到网址栏中。