How can I specify a particular user-agent string in a command-line invocation of Firefox?

大兔子大兔子 提交于 2019-12-12 01:29:14

问题


I would like to make a bash script that will iterate over different user agent options, open Firefox with the selected user agent, wait for x seconds, and then close, and loop.

Is there a command-line option for firefox to specify the user agent?


回答1:


There is no flag for this specific purpose, but you can create a set of Firefox profiles, where each profile will specify a particular user agent.

There is an about:config option general.useragent.override, which you can specify in the user.js file in the profile folder with a line like:

user_pref("general.useragent.extra.firefox", "Mozilla/5.0 AppleWebKit/537.36…")

You can then start Firefox with the -P flag, providing the name to the specific profile.



来源:https://stackoverflow.com/questions/42093473/how-can-i-specify-a-particular-user-agent-string-in-a-command-line-invocation-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!