I have a Flash app at URL-A. I have a new non Flash version, that only works in modern browsers at URL-B. I can redirect all visitors from URL-A to URL-B with .htaccess or PHP but I wont know what browser they have in order to determine if I need to redirect or not.
So I am not sure what the best way to go about this is.
Basically if you are using IE8+, FF, Chrome, Safar, Opera I want you to go to URL-B. If you are using IE7- I want you to go to URL-A
Whats the best way to do this?
If you have no problem with using a small PHP library, look at the answer to this question and do a header("Location:url") redirect depending on which result you get.
If you'd rather use a .htaccess file, you could parse the USER_AGENT as shown in this question (it's aimed at mobile browsers but doesn't really matter). The PHP solution is much more convenient though.
Related
I've integrated this nice Facebook-Button to my WordPress site via iframe. Although I care for cross-browser-compatibility plus the fact I could not influence the iframe content in regular ways I'm wondering why this quirks when viewed in IE6.
Could I've done something wrong anyway or is it conceivable stuff quirks by default and Facebook doesn't care about that?
Facebook does officially not support IE 6 any more.
(And I’m glad about that. Just wondering why you still care?)
Please forgive me if this answer is somewhere else on this site or online. If it is, I sure haven't found it in the past several days of searching.
What I am hoping to find is an "accurate" method of detecting a browser and redirecting to a simple, static page if not a recent browser.
The samples I have found until now often have not provided an accurate representation of the actual browser being used. For instance:
When testing with Navigator 9, I'll get a message that I'm using Firefox 2
When testing with Maxthon 3, it reports I'm using IE 9.
My site displays correctly in all the current browsers I've been testing it with. But I wish I could have a basic static page for those .01% who still are using an old browser for whatever reason. They could still get some basic information from my site, as well as encouraged to update to a more current browser.
If anyone has any useful suggestions, I'd greatly appreciate them.
Thanks so much.
Cheers,
David
Browser detection is never perfect, for a variery of reasons. If you are using jQuery, you should look into jQuery.browser.
I'd try to detect the browser on the server side and do an HTTP redirect if the browser is something non-standard. Most decent frameworks have functionality to detect the browser from the user agent string. Again, this is not perfect, mainly because of the data browsers report. Also, if Maxthon reports it's IE, that's because it is based on IE and therefore the layout engine should be the same.
So you either
support a small number of browsers and cater for their quirks, sending all other browsers to a basic page (this sucks for future versions of browsers because they might be standards-compliant but they will still display your very basic page), or
you have a standards-compliant page for all browsers and then you define alternatives for the ones that give you problems.
I'd go for the second option. It usually all boils down to one version for all browsers, and a number of hacks for various versions of IE. Also, remember to avoid padding in your CSS and use margins instead.
In the end, you probably shouldn't be testing for browsers and version numbers, but supported features. Try using Modernizr.
The $.browser property is deprecated in jQuery 1.3. On jQuery support site, they strongly recommend to use the detection feature (JQuery.support) instead of the jQuery.browser property.
Actually, this has been answered already in another question, please check here How can you detect the version of a browser?
On an iphone, you can add a favourite when on a webpage and if that webpage has the correct meta tags for iphone, it gets an icon and can even 'hide' the browsers chrome and display just like an App. With html5 http headers you can even have the phone completely cache the 'app' so that it never has to contact the server again.
The problem I have is that I want to write apps that make xmlhttprequests to a server that is not the server they were originally from. I heard its possible to do this if you somehow export your favourites and HTML5 chache then manually edit the export file to change the URL for the favourite, then import them again, so that the phone doesn't think the javascript is trying a cross site xmlhttprequest.
However I have not found anything like that (maybe it was a jailbreak thing?). At the moment I have to have a proxy on the server where the 'app' originally came from, which is obviously very annoying.
I also heard that there was a special meta tag that allowed you to specify one other domain for xmlhttprequest, it had something to do with specifying that the page was actually a mirror and should be treated as if it came from another domain. Does anyone know what meta tag this is? I tried searching all over apple and found nothing.
I believe it might also be possible if you can get webkit to treat the cache as a file:// protocal, because then cross site security will not apply.
The answer is this is not possible and is not meant to be possible.
I'm looking to do a fairly "normal" useragent check with TYPO3, to detect for any mobile devices, and ALSO check to see if a cookie is set to disable the mobile redirect. In other words, sudo code would be as follows:
if(is a mobile device) && (cookie isn't set for disable mobile)
{
redirect user to domain.com/mobile
}
This is all I'd like to be able to do! Can anybody give me any tips? I know you're able to use typoscript to check for a particular user-agent using [useragent = ...], which might work for the user-agent detection, but I'm not sure about the redirect OR checking for a cookie!
Thank you!
the [browser=] condition in TypoScript is not very detailed yet might be enough:
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.4.0/view/1/4/#id2315154
If thats not enough, consider writing your own condition using [userFunc=functionName(foo)]. That has always proven to be one of the quickest ways in such situations.
I'm not aware of a redirect tag in TypoScript, again I'd suggest usage of a userFunc in which you use PHP's native header() function. If you chose to walk on this path, consider that USER Objects are not working the same way userFunc Conditions do. The conditions cannot process classes. Its just a file of functions which got to be included in a php file like extTables.php (includeLibs does not work!) while the USER or USER_INT object needs a class which is inculded in TypoScript via IncludeLibs.
More:
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.4.0/view/1/7/#id2639787
http://www.florian-rachor.de/artikel/typo3-condition-mit-user-function (use google translate if German poses a problem)
Oh, it might be easiest to store it all in a USER object. In there you can use all sorts of PHP code. Hope that helps you.
cu
Roman
We use a Javascript based redirection which stores the preferences in sessionStorage (Fallback: cookies): https://github.com/sebarmeli/JS-Redirection-Mobile-Site
Just include the JS in your header Data.
Drawback of this solution is, that the page is rendered fully by TYPO3 and redirected afterwards..
I am building an iPhone Wikipeida game app, that requires modifying the default Wiki HTML a little bit (mostly simplifying the page).
So far I am directly downloading the HTML output from en.wikipedia.org/wiki/Article_Foo to a python Google App Engine, and then modify its CSS and HTML structure, cache it, and finally output to iPhone. It works but I find this method quite tedious, there must be a better method?
Please note that I use App Engine not just for parsing the Wiki, but the game also requires it to keep the stores...etc, hence not a overkill. Also, I would prefer doing all the work with python on App Engine, to keep the iPhone client as thin and mobile as possible (XML on iPhone is a big no fun)
Thanks a lot.
=======
Nick mentions why not use the mobile Wiki which already optimizes for iPhone. However, the issue is that it goes down quite frequently (every couple weeks or so), also its HTML structure changes quite frequently too.
You can use the MediaWiki API to download the markup text and use some API tools for Python that could make the process/modify work easier.
Caching and outputting to iPhone is fine. I believe there is not much to simplify here.
Why not just fetch the mobile version of the page from http://en.m.wikipedia.org/? This is already formatted for mobile devices.
You can set up your own copy of the server used by m.wikimedia.org:
http://github.com/hcatlin/wikimedia-mobile
It's written in Ruby, but this shouldn't be an issue if your app just uses the HTML output.