Hi,

I just wrote a little script to switch proxy based on regexps of the
url when loading a new url.  Basically it imitates the functionality
of the FoxyProxy Firefox extension.  I am using
"content_buffer_location_change_hook" to call my function, but it
appears to call after the page has been loaded, so I have to refresh
after a load for this to work.

Does conkeror have something analogous to defadice in emacs or is
there a hook which would be called before trying to load the page?

Thanks -- Eric

just for kicks, here's the code[1] (my first javascripting)

-- 
schulte

[1]
// every time we open a new url change proxy based on url (like FoxyProxy)
add_hook ("content_buffer_location_change_hook", proxy_by_url);

function proxy_by_url(buffer)
{
    // regexp to match url
    myre = /.*my\.work\.domain\.org.*/;
    if (myre.exec(buffer.current_URI.spec)) {// change proxy
        session_pref("network.proxy.socks", "127.0.0.1");
        session_pref("network.proxy.socks_version", 5);
        session_pref("network.proxy.socks_port", 3001);
        session_pref("network.proxy.socks_remote_dns", true);
        session_pref("network.proxy.type", 1);
    }
    else{// default to no proxy
        session_pref("network.proxy.type", 0);
    }
}
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to