Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Can a Hosts file be edited to make a certain browser open specific URL's?

  1. #1
    WebProWorld MVP Clint1's Avatar
    Join Date
    Jun 2003
    Location
    Sitting down in a chair
    Posts
    2,225

    Question Can a Hosts file be edited to make a certain browser open specific URL's?

    Hi all. Does anyone know if it's possible with a line or lines in your Hosts file to redirect a URL/domain to a specific browser?

    I'm beyond FED UP with this conspiracy to force everyone to use certain browsers and versions. Certain websites are cloaking their content extorting visitors to conform to their browser ideals. I've never seen such a thing happen in all my years on the internet. The most appalling thing is you can actually see the content underneath their translucent "masks" but you can't scroll nor click anything other than their "demand". This proves the content is usable in older browsers!

    I'm tired of having to (in IE with a hack) right click and "Open in FireFox" or "Open in Chrome", or (in FF) right click and "Open in IE".

    There are numerous websites that I previously would go to all the time, and it is those websites I wish to automatically redirect the browser request to certain browsers without having to do anything. So that when I click a link anywhere, or enter the URL in the address bar, the default browser request to open is overridden to the alternate browser. I would think this could be done via the Hosts file, because you can redirect URL's to different URL's. But after trying various lines I can't see how to do this with browser requests. Is this possible?

    Thanks.

  2. #2
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376
    Not possible.

    The HOSTS file serves simply as a local machine specific DNS.

  3. The following user agrees with deepsand:
  4. #3
    WebProWorld MVP Clint1's Avatar
    Join Date
    Jun 2003
    Location
    Sitting down in a chair
    Posts
    2,225
    Ok thanks.

  5. #4
    WebProWorld MVP Clint1's Avatar
    Join Date
    Jun 2003
    Location
    Sitting down in a chair
    Posts
    2,225
    There's got to be a way to do this. If not via Hosts file, then by some other means. I've seen malware that redirect certain URL requests to other URL's, so why not other apps? This doesn't seem like a very difficult thing to do.

    Look at XP's Folder Options > File Types where you can control which file types trigger which specific programs to open them; such as the way .html (and associated webpage formats) are opened via IE (if that's what one chooses). The problem there, is you're dealing with file extensions and a URL isn't exactly a "file extension". If you could create a new file type, without just an extension, there may be a way to accomplish this.

  6. #5
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376
    Well, yes, it's possible.

    But, it would need to be a browser extension, since it's the browser that is making the request and receiving the response.

  7. #6
    WebProWorld MVP mikmik's Avatar
    Join Date
    Aug 2003
    Posts
    1,525

    Red face

    Oops, I misread the OP and now I can't delete this! Well, if people want to avoid the problems that you are talking about, clint , I might as well leave it, haha, fu#*.

    I am not sure here what you are actually asking. If it is your own site, you just use a CSS file that renders your pages properly for each browser, and that, in turn, is called on the basis of the user agent string, or browser identity.

    You can also code one CSS file that have the <-- if [IE6]> stuff that bloody doesn't make sense but works on IE6 <![endif]--> conditional comments, like so:
    Code:
    <!--[if IE 6]>
    Special instructions for IE 6 here
    <![endif]-->
    Explanation at quirksmode: Conditional comments.

    Wait, I used google and found this site, it shows how to use conditionals for every browser, and then some. It's going into my favorites right now:
    http://www.conditional-css.com/advanced

    You can also use mod_rewrite, and in fact, this is among the first ten returns for the search terms browser+redirect+.htaccess :
    http://evansims.com/6032/using-htacc...lete-browsers/ ,
    but I can deduce from this page on "modern mobile browser redirects" that you can just request the browser agent user string outright, and redirect to different pages from that:
    Code:
        RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
        RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
        RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
    Actually, that page is going into my favorites, also, but then I think, "Why bother? Just google it whenever!"

    Sheesh!

    Actually, there is something I used to use when checking my own sites, called optool, and it runs in the system tray (beside the clock in the task bar).

    Not sure if it works on x64 windows, but you just click it and a menu pops up with a list of your browsers you can click on to open the url from your open browser. Yes, I think we are on to something here:
    Do you sometimes land on a page that doesn't work in your favorite browser? Or do you want to check your web creation in other browsers? Well, then Optool is for you!

    Optool cannot only open different browsers, it can also on your choice close the currently open browsers. No problem if you suddenly find your desktop cluttered with just too many browser windows. Let Optool close the browser windows your don't need! (It can close other kinds of windows too, BTW!)

    Need to resize the browser to check the layout you're developing? Well, Optool can do it for you. Just tell Optool which window sizes you need regularly or stick to the four standard screen sizes already built-in.

    Do you ever find yourself stuck somewhere deep down a web site with no "home" link? Optool can navigate the browser to the root (home page) or just one level up. It can even go to the domain root (like www.google.com instead of images.google.com).

    Ever needed a internet shortcut on the desktop or somewhere else? Optool can make it from any supported browser!
    I just tested it on Win7 x64 and it works flawlessly. My Kingsoft PC Doctor freaked out on me, and even removed the install.exe file, but I know it is safe, it doesn't install to registry, it is a standalone app.

    I'm gonna keep it, I hate sites that don't work properly, either!

    The only problem I noticed is that it couldn't read the url from FF with other tabs open, but I opened Chrome and used that page to open IE9. You can configure this little baby for as many browsers as you want, so if you have different versions of IE installed, or standalone, you can use them with optool.
    It's a decent little program! HTH
    Last edited by mikmik; 02-13-2012 at 04:24 PM.

  8. #7
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376
    Quote Originally Posted by mikmik View Post
    Actually, there is something I used to use when checking my own sites, called Optool, and it runs in the system tray (beside the clock in the task bar).
    This does just what Clint's customized right-click menu does. Given that it's external to the browser, a bit more convenient when using browsers whose versions are in a constant state of flux.

    Quote Originally Posted by mikmik View Post
    My Kingsoft PC Doctor freaked out on me, and even removed the install.exe file, but I know it is safe, it doesn't install to registry, it is a standalone app.
    Perhaps because it's a compressed executable. Kreacom now offers an uncompressed version so as to avoid such false positives from security apps..

  9. #8
    WebProWorld MVP Clint1's Avatar
    Join Date
    Jun 2003
    Location
    Sitting down in a chair
    Posts
    2,225
    "mikmik": all that typing for nothing. You need to read my post again. This has nothing to do with a website per say, it 'simply' has to do with my own default browser opening a different browser when certain domains are clicked.

  10. #9
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376
    Quote Originally Posted by Clint1 View Post
    "mikmik": all that typing for nothing. You need to read my post again. This has nothing to do with a website per say, it 'simply' has to do with my own default browser opening a different browser when certain domains are clicked.
    He did catch that, after he'd posted.

    He then edited, to replace the 1st paragraph with what you now see, and to add the stuff re. OpTool, which is relevant to your matter.

    A bit confusing as it ended up.

  11. #10
    WebProWorld MVP Clint1's Avatar
    Join Date
    Jun 2003
    Location
    Sitting down in a chair
    Posts
    2,225
    Yeah I saw that he edited the post, but what he ended up typing/leaving was still N/A because it was CSS, etc.

    Mikmik see this post, a much better method than having to install something and have to have it running all the time in the System Tray: http://www.webproworld.com/webmaster...rome-or-other?

    I need to try and figure out how to do this in Chrome but I can't find the info in the Registry nor in any Chrome folders. I wonder if there's an extension for it like FF has? But of course that would add yet another "chrome.exe" running in the background.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •