Browser, device detect web server plugin?

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
morps
Posts: 122
Joined: Sat Nov 01, 2003 9:11 am

Browser, device detect web server plugin?

Post by morps »

I suspect like a lot of you, I have multiple client devices I wish to use with my control pages: iPod Touch, iPhone (retina resolution), Droid phone, iPad...

I have optimized my control pages for each of my devices and effectively replicated each control page set. At the moment, I have bookmarked the appropriate root page for each device so it can have the proper control pages that look best for it. But this seems silly.

I see two ways to solve this, there are probably more:

Server side Javascript:

Code: Select all

<script type="text/javascript">
if ((screen.width<=800) && (screen.height<=600)) {
 window.location.replace('http://127.0.0.1/controlpage?name=highResCP&useJS=True);
}
else {
   window.location.replace('http://127.0.0.1/controlpage?name=lowResCP&useJS=True');
}
</script>
Downside is going in to the appropriate file in /IndigoWebServer and hacking in the above code would only last until it gets written over the first time Matt and Jay push out an update.

Web Server Plugin
A plugin that would allow the user to define all parameters (screen resolution to target, control page to pull, etc). This seems far more elegant and what's more, would (I hope) survive through regular updates Matt and Jay do to Indigo itself.

Anyone have thoughts on this? Anyone wanna write a web plugin? :)
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Browser, device detect web server plugin?

Post by matt (support) »

I like the idea of an auto-redirect Web Server Plugin. Ideally, this functionality would be built into the main Web server but since it isn't yet I think a Web Server Plugin would be a good interim solution.

It seems like it would be pretty straight forward to implement. Want to give it a shot? :-)

Note you could forgo the end user selectable parameters and instead just have hard code it for common device screen sizes. So that when the screen width < 600 the suffix "_300to600" is added to the Control Page name and it is redirected, when width is between 600 and 800 "_600to800" is added to CP name, etc. Not as flexible, but seems like it might cover the common cases and offer 2 or 3 different screen sizes.
Image
Locked

Return to “Extending Indigo with Plugins and Python”