Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Wndows hosts file editing question

Options
  • 27-01-2011 5:04pm
    #1
    Registered Users Posts: 40


    Hello All,
    If anyone know how to make your browser to reconize host files changes without having to restart the entire browser.
    Is there a registry tweak, can you code something in C, Java, C++ dosent matter . I tried ipconfig /flushdns but no joy.
    please help.
    Thanks


Comments

  • Registered Users Posts: 1,456 ✭✭✭FSL


    Why would you want to change your Windows Hosts file and have it take effect without restarting the browser?


  • Registered Users Posts: 40 team eGlobe


    editing hosts to block particular webisite. but on IE, need to restart browser to get the result


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    yes but why is the restart such an issue?


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Adam wrote: »
    yes but why is the restart such an issue?

    Because it's not generally required on OS's other than Microsoft Windows. Just an annoyance.


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Naikon wrote: »
    Because it's not generally required on OS's other than Microsoft Windows. The resolver library is very specific. Just an annoyance.
    that's why i'm wondering why the OP would even want to go down the road of writing software to get around this, it's an annoyance but how often does one update the hosts file?


  • Advertisement
  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Naikon wrote: »
    Because it's not generally required on OS's other than Microsoft Windows. Just an annoyance.
    You won't find another browser on any other OS that doesn't have the same behaviour. You don't have to reboot windows for the hosts file to be re-read.

    Browsers will usually cache DNS lookups, for obvious reasons. If it's possible to instruct the browser through scripting to dump it's DNS cache, then this is possible. Otherwise there is no way around it.

    What you will need to do is edit the hosts file, dump the dns resolver cache (ipconfig /flushdns) and restart the browser.

    It's a poor man's fix though. If the user knows the IP address of the website, the hosts file becomes meaningless.


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Adam wrote: »
    that's why i'm wondering why the OP would even want to go down the road of writing software to get around this, it's an annoyance but how often does one update the hosts file?

    In a large network with a BIND master/slave setup - never generally, unless the sysadmin sets the hosts file on each machine. A centralised lookup database is far more
    scalable and efficient(also easier to manage) than using individual host files. /etc/hosts is a legacy concept taken from the days when the DARPANET spread across a
    few educational institutions. It was never a brilliant concept beyond a few static setups imo.


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    seamus wrote: »
    You won't find another browser on any other OS that doesn't have the same behaviour. You don't have to reboot windows for the hosts file to be re-read.

    Browsers will usually cache DNS lookups, for obvious reasons. If it's possible to instruct the browser through scripting to dump it's DNS cache, then this is possible. Otherwise there is no way around it.

    What you will need to do is edit the hosts file, dump the dns resolver cache (ipconfig /flushdns) and restart the browser.

    It's a poor man's fix though. If the user knows the IP address of the website, the hosts file becomes meaningless.

    Well, I just tried it out on Fedora 14 and the changes(redirect boards to 0.0.0.0) took immediate effect without a firefox restart. Of course you can dump the lookup cache, but it was not required in this instance. Not running a local caching
    nameserver mind you. Seems to be a Windows thing imo. Firefox should not be caching dns requests anyway. That is what a caching nameserver is for. BIND, pdnsd or even dnsmasq would fit the bill for a caching nameserver. Much better
    than a ropey firefox caching setup. A browser is great for browsing, not so much when handling dns lookups :D


  • Registered Users Posts: 40 team eGlobe


    writing a simple desktop application to block websites for specified time. used proxy method and worked perfect on all browsers except chrome. then wrote an extension for chrome to work. but if user wants they can disable that extension and browse the site. then thought of using hosts file method on top. but this restart browser to get that to work is not good to me. Chrome and Mozilla work without restart though.
    few minutes back a friend suggested to execute this command nbtstat -R .(don't know what this command does)
    this seems to be working with out restart. can some one else please try and let me know(I have only one pc)
    Thanks for ur time


Advertisement