擅长:python、mysql、java
<p>抱歉,还没有测试过,因为我的Mozilla东西本来就是坏掉的atm。在</p>
<p>设置它的一种方法是创建自定义设置文件<a href="https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferences" rel="nofollow">prefs.js</a>,并将该目录设置为配置文件目录:</p>
<pre><code>profdir = '~/.config/mozilla'
profile = 'foo'
mozembed.set_profile_path(profile_directory, profile)
</code></pre>
<p>现在,gtkmozbedded应该从<code>~/.config/mozilla/foo/prefs.js</code>读取首选项。示例<a href="https://developer.mozilla.org/en/Gecko_user_agent_string_reference" rel="nofollow">custom user-agent</a>条目:</p>
^{pr2}$
<p>另一个选择是重载<code>gtkmozembed.*_stream</code>函数,使用<code>urllib2</code>注入自定义的<code>User-Agent</code>头。在</p>
<p>请尝试WebkitGTK+和gobject自省。Mozilla和GTK+在GTK+-3之后有点不好。在</p>