nau*_*rus 2 browser firefox internet-explorer reload
我是一名网页设计师,当然我必须与每个主要的浏览器一起工作(没有IE 6,因为它是如此痛苦的屁股,我需要 png透明度,没有任何解决方法).我一直在寻找一种方法来同时运行和重新加载Firefox,Webkit浏览器(Chrome)和IE 7和8.
(我已经得到了我的需求的答案,我将在下面发布以供其他人参考,但我确信有更好的方法.)
这就是我解决它的方式:
浏览器打开:
在我的网站代码中,我有一个静态标题,以便我可以通过其名称引用每个浏览器窗口.例如,"这是我所有页面的标题"的标题导致firefox窗口名称为"这是我的所有页面的标题 - Mozilla Firefox".
在compiz下我设置了一个键盘快捷键(Ctrl + j,因为它很容易到达)在/ home/username/bin中运行一个名为refresh_all的脚本(不要忘记制作这个可执行文件).
这是refresh_all的内容
#!/bin/bash
currentwindow=`xdotool getwindowfocus`
id=`xdotool search --title '[Site Title] - Google Chrome'`
xdotool windowmap $id
if [ $? = 0 ]
then
xdotool windowactivate $id
xdotool key 'ctrl+r' $id
fi
id=`xdotool search --title '[Site Title] - Moz'`
xdotool windowmap $id
if [ $? = 0 ]
then
xdotool windowactivate $id
xdotool key 'ctrl+r' $id
fi
id=`xdotool search --title '[Name of Virtual Machine]'`
xdotool windowmap $id
if [ $? = 0 ]
then
xdotool windowactivate $id
xdotool key 'ctrl+r' $id
xdotool key 'alt+Tab' $id
xdotool key 'ctrl+r' $id
fi
#xdotool windowmap $currentwindow
xdotool windowactivate $currentwindow
Run Code Online (Sandbox Code Playgroud)
脚本对我来说是这样的:
你必须有xdotool(sudo apt-get install xdotool).取消注释第2行到最后一行将确保在完成所有刷新后,您打开的最后一个窗口将重新打开.
我能想到的另一个解决方案是进行一次AJAX调用,检查是否每秒都设置一个名为do_refresh的会话变量,如果有,请刷新浏览器,然后编写一个脚本,将'| do_refresh'附加到末尾.所有的php会话文件,当你想重新加载,但这不会将浏览器提升到前台(这是我想要的,因为我有4个显示器,所以第一个代码,第二个是chrome,即8和9上第四个和firefox在第四个并且当我对我的代码进行更改时让它们全部出现非常好,但是如果你使用1或2个监视器运行,你可能实际上并不希望窗口成为焦点.(旁注:4个显示器甚至不够:X如果要获得大量显示器,请获得6.)
Phew,这是相当的帖子.只是想在stackoverflow上获取这些信息,这样每个人都可以享受同时重装狂喜.
| 归档时间: |
|
| 查看次数: |
1149 次 |
| 最近记录: |