Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[plugin] [ORPHAN] ako_ifBrowser
Howdy all. I’d like to announce my newest plugin, ako_ifBrowser. As you can probably guess, this conditionally includes enclosed text based on the browser user agent.
I’m more than happy to entertain questions, comments, complaints, concerns, bugs (and fixes), and of course, donations (I’ll be good for this one within a week or so).
Enjoy folks…
Last edited by akokskis (2005-09-10 03:16:19)
Offline
#2 2005-09-10 04:23:02
- Vitruvius
- Plugin Author
- Registered: 2004-09-21
- Posts: 125
Re: [plugin] [ORPHAN] ako_ifBrowser
Well done akokskis – I’m sure this will come in handy. I’m downloading and testing right now…
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
Works like a charm! Thank you!
Feature request: Is it possible to add an additional attribute for removing the browser message after the first visit?
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
Feature request: Is it possible to add an additional attribute for removing the browser message after the first visit?
I’m not entirely sure what you mean by this. Could you explain it a bit more?
Do you basically mean that it will only display the conditional message the first time a user visits the site? (ie: set some sort of cookie, etc).
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
> akokskis wrote:
Do you basically mean that it will only display the conditional message the first time a user visits the site? (ie: set some sort of cookie, etc).
Yep! That’s exactly what I meant!
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
Ok then, I’ll look into it in the coming days and I’ll try to get back to you (and everyone else) asap.
Offline
#7 2005-09-10 05:17:13
- Vitruvius
- Plugin Author
- Registered: 2004-09-21
- Posts: 125
Re: [plugin] [ORPHAN] ako_ifBrowser
Have tested this and it works as you say in the help file – most of the time. For some reason it was not detecting Opera 6.03 on the Mac – but that’s no big deal.
I don’t really support CreativeSplash’s idea to ‘remove the message’ after the first visit – which would involve setting a cookie. I think this plugin can be used for significantly more than delivering a browser message.
My feature suggestions:
- A way to specify a browser version and above or and below. eg ie6+ or ie5.5- This way when ie8 comes out I don’t have to go back and fiddle. Looking at the php – I suspect this would not be easy to implement.
- A code for ‘unrecognised browser’
- I noticed there was no ie4 support – still I hope no one is viewing my sites with ie4 !
- A <code><txp:ako_elseifBrowser></code> which would be used after the standard ifbrowser and returned if the first condition was not met
- As a different tag within the same plugin, a tag to return the UA(user agent) for display
Just my quick thoughts.
I think I can implement this plugin for loading different CSS files like this:
- In the <code><head></code> section, have a generic CSS file statement to load the most modern CSS file
- Then put the ako_ifBrowser tag after this and load specific CSS for some older browsers which should over-ride the above CSS for all elements defined.
Thanks again for your endeavours!
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
@Vitruvius- Sorry, but there’s been a slight misunderstanding. What I meant was an attribute (e.g cookie=“1”) which when used will remove the message after the first visit. Those who want it on a permanent basis should be able to do it without modyfing the existing tags (without providing any extra attributes).
I hope I’vem made it more clear this time.
Regards,
Vasanth
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
> Vitruvius wrote:
> I think I can implement this plugin for loading different CSS files like this:
> # In the <code><head></code> section, have a generic CSS file statement to load the most modern CSS file
> # Then put the ako_ifBrowser tag after this and load specific CSS for some older browsers which should over-ride the above CSS for all elements defined.
Please don’t use browser sniffing to do that, it can easily mean that capable modern browsers miss out. Does everyone remember to include Shiira, Omniweb, Camino in their sniffing? There are too many webkit based browsers to keep up with, and thats just Mac browsers. Also, don’t forget that Opera identifies itself as IE by default, but is a very capable CSS browser. I know thats kind of its own fault for being so silly in the first place, but still, we shouldn’t discriminate.
Then there’s the problem of new browsers that come out, and having to update the sniffing every time.
Its best to use CSS filters to aim at browsers. For instance, using import naturally excludes all browsers earlier than 5. There's a great "list of all filters, and what browser they target here":http://www.dithered.com/css_filters/css_only/index.php. Personally, I only use
import, with one that targets IE 5. When I need to target IE 5.5 or 6 specifically, I use conditional comments and a separate CSS file, keeping hacks out of the main css file if possible.
Cheers,
Jon VC#9
Offline
Offline
Re: [plugin] [ORPHAN] ako_ifBrowser
skoggy, I don’t think so(?). Here’s the link again.
Offline
#12 2005-09-10 15:40:35
- Vitruvius
- Plugin Author
- Registered: 2004-09-21
- Posts: 125
Re: [plugin] [ORPHAN] ako_ifBrowser
jonhicks wrote:
Please don’t use browser sniffing to do that, it can easily mean that capable modern browsers miss out.
The way I had proposed would not exclude any browser. As I said in my post: I put a generic load CSS statement (with no ‘ifBrowser’) for all modern browsers at the top, then simply use this plugin after that to neatly (without using hacks like @import or other filters) load in some extra CSS for specific older browsers – notably IE 5.x, IE 5.2mac etc.
I’ve not tried it – but it sounds like it would work well..??
Offline