Published in Web Development on Thursday, October 7th, 2004
Tie together some cloaking and the user-agent string widget for Firefox and you've got a handy tool.
Here's a little trick that we've been using lately for certain things, cloaking!
Disclaimer: we've used this trick in the situations descibed below and it has worked well. It is not super secure, so use caution when applying!
Tied together with the User Agent Toolbar Widget, we've been using cloaking for things from private site previews to in-situ error testing. How you ask?
We recently finished a redesign for a clients site. What we wanted was a way to lay the new site (new script) over the old one, and have our client, with offices across Europe, be able to seamlessly preview the new site, without the general public sneaking a peek.
In this case what we did was have the server check the user-agent string of the browser for a "top-secret" agreed upon string that the client set in the UA widget. Depending on the value, the script would serve up the appropriate site. We could have done this with specific IP's or a login screen somewhere, but this method was simple, fast, and we managed to get quite a few people to download and install Firefox - they had to to see the site!
error_reporting(E_ALL) in PHP based on the presence of a certain UA string, for example, and again trouble-shoot privately and in place.Any others ideas??
we managed to get quite a few people to download and install Firefox
Yeah, that's most important!
Beautiful idea! Just remember to switch back afterward or risk a run of 'browser not supported' errors.
That shouldn't be an issue, if I follow you here :-]
Every browser gets a site, just one's with special UA's get the special peek or whatever you're up to.
Highly unlikely but I wonder... since I assume you're applying this technique to a live, publicly indexed site could search engines penalize the site's ranking by interpreting it as typical SEO cloaking attempt?
The only thing I notice about this method is that it doesn't seem to let you test in other browsers. You can only test in firefox, so it seems it's more of a sneak-preview rather than a testing stage; which is what you called it (sneak-preview), so I guess you're exactly right!
Great idea! I'll try and implement it soon
I can not see the point with this solution!? Maybe that I have missed something...
It seems to me like this solution is similar to a tailored URI-variable, for instance http://myDoc.php?id=xxx&mode=sneak-preview
Especially since you will have to change every excisting page to redirect all "Super-Agents" to your new website.
Have you at all considered using a different http port(not 80) for this? Maybe that would create problems that I've missed while thinking....
Besides from that I think that your solution is a good way to get people to use FF, but not so good since you can't test the website with different browsers...
Hey Kalle, really, the usefulness of this depends on how you set up your site.
For example, we tend to use a central script format that handles everything. This makes it easy to drop a test for the useragent into the htaccess file and serve up one script or the other.
We also rewrite our urls, so adding a ?mode=sneak-preview in there would be a pain, especially because you would have to add it to every single link in the new site in order to click thru smoothly and see the new stuff.
Playing with the port is cool too if you have that kind of control. Most people don't, being on shared hosting.
Comments and Feedback