I would really like to check out the source code of some website. They have a mobile detection script of some sort I guess, when you visit said website it redirects you to a mobile version (nope, entering the URL that they redirect me to in my browser doesn't work).
How can I pretend my computer is an iPhone or HTC or whatever?
Install this add-on for firefox which will let you change the user-agent string.
https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/
You may also like to try and OPEN the page in TEXT pad
Here is a simple version I did up for a client
http://www.baccus.net.au/m/index.php
NOTE that it strips the PHP and just leaves the HTML component
You can then SAVE AS html page and see what the page looks like.
You may need to do a BASE HREF to keep the full path and there are often problems with many CMS systems, but this will get you over the line quickly.
Hope this helps
if you are using PHP try this $_SERVER['HTTP_USER_AGENT']
you get phone company + model + browser info or os info !
The link in the accepted answer no longer exists. The recommended alternative currently:
https://addons.mozilla.org/en-GB/firefox/addon/user-agent-string-switcher/
Related
Is there a way to specify the web browser to be used in a href tag ? For instance, I have the following URL and I need it to be opened with Firefox only :
LPO Vienne
Thanks for your advices !
Actually it is possible these days - at least in the case of Microsoft Edge. Check this out. Although agree with ProWebMonkey that usability issues still apply.
This is not possible. If it was it would have to work on the assumption the user would have that browser, so even if it was possible it would not be a very good solution.
You could always have a notification on the linked page, explaining the user should use a specific browser, if they are not already. This would be more user friendly and you could provide a link to download etc.
Not true at all. It is possible like this:
A HREF="microsoft-edge:http://www.yoururlgoeshere.com"
the call "microsoft-edge:" before the actual URL will force the link to open in that browser, assuming the browser is installed on the machine.
i am not sure..is there any chance to open my webpage in firefox. for example i am browsing mywebsite using IE. when ever i click link of the page then automatically it will open in firefox. this option is not for all pages only for specified page.
thanks.
If this were the case, ie6 would have gone out long ago. The best you can do here, would be to check which browser they are using (get_browser if you are using php) and refuse to show content to people using browsers other than firefox.
Instead you could redirect them to a page explaining why they need to be using firefox to access your websites services (I guess a link to the firefox download page would be nice too)
Sorry, it's not possible from plain HTML to open a webpage in a different browser. You can, at most, open the page in a new window of the same browser.
However, what you ask is not completely impossible. You could write a browser plugin that handles links and runs the Firefox executable
I would seriously hope this isn't possible.
What you ask for is not possible , but you could display a warning to your users that the page works best in the desired browser.
I am looking for something that will help me learn how to set up my site so that when people go to it there is the regular version and the mobile version. Problem I am having is that most of the sites I see on google are pay sites that help you set that up. Can I just make two versions of my site and load them both on my hosting? Also how does it know when to load the mobile versus the regular? These are the types of things I am looking to learn, any suggestions of places to start?
Please please please make sure you do the following:
Only do a mobile version if it adds value.
If a user requests a deep link from a mobile device, don't redirect to the mobile home page
Allow the user to choose to view the full version
Make sure tablets such as the iPad uses the full version by default
Don't serve WML to the hi-res smartphones such as the iPhone
If your full sized website is unusable on a phone, consider tweaking it to be more suitable (don't print content text too wide).
Modern iPhones and iPads are perfectly capable of handling most full sized websites, there is little need for a mobile version unless it actually improves the user experience. I hate to get redirected to a baby interface that doesn't provide the information I need.
Good examples of mobile versions include:
Google website
Gmail website
Mediocre examples include:
Any blogpress site
Bad examples include
anything that uses WML
Here's Apple's advice on providing mobile versions to the iPad:
Note that the Safari on iPad user
agent string contains the word
"Mobile", but does not contain the
word "iPhone". If you are currently
serving mobile content to any browser
that self-identifies as "Mobile", you
should modify your user agent string
checks to look for iPad and avoid
sending it the wrong version of your
site. The version numbers in this
string are subject to change over time
as new versions of Safari on iPad
become available, so any code that
checks the user agent string should
not rely on version numbers.
Something to look into would be the #mobile css media type, which is used to load a different styles when loading in a mobile device. I am not sure which devices support it, but I imagine it would be most of the popular models. As far as your suggestion, you can certainly host two separate sites, but I would defiantly go through Alex's suggestions before you go through the trouble.
http://www.w3.org/TR/css-mobile/
Alex had some good suggestions, but if you really want to serve up a specific version based on mobile or non-mobile you can take a look at the http header. In some cases the User Agent will give it away, but not always. Check out this link for details: http://detectmobilebrowsers.mobi/
What's the standard, most reliable way of doing this? I need to redirect a user to download the Mac version or the Windows version of my software when they click "Download" on my website.
In Javascript:
http://www.quirksmode.org/js/detect.html
No method is perfect, because the user can always spoof the user-agent.
I would recommend that:
1) Auto-redirect to a page with the link, or auto update the link on a page with text saying "Download for Mac" or "Download for Windows", so that the user knows what they are getting before they click.
2) Still give the user the option of downloading the other version, in case your detection does not work in their case, or if they want to download on a remote machine, and transfer it to a different machine later.
It is easily spoofed, but you can take a pretty good guess by examing the user agent string. You can do this in JavaScript or your server side language.
Because you may detect it incorrectly, you should place somewhere a "Want the Mac OS X version" etc somewhere.
You want to look at the user agent found within the http header.
User Agent
Not 100% reliable, but you can infer much from a user-agent string in the HTTP header.
You need to use navigator.platform or parse navigator.userAgent. Example.
I'm tyring to get phonegap up and running on blackberry storm (9530 simulator). I had been testing my webapp from withing BB's built in browser, and it was looking ok, but then it totally bit once I tried to look at the some code from within phonegap, even though I was pointing phonegap to the same url (I hadn't yet gotten to the point of running code locally on the device).
I tried a test case on google and got similiar results. see below. I suspect that I'm missing something basic here. I would have expect both images to be nearly identical.
Browser
http://www.eleganttechnologies.com/outside/ImgDeviceBB9530WebGoogle.jpg
Phonegap
http://www.eleganttechnologies.com/outside/ImgDeviceBB9530PgGoogle.jpg
[Update]
To shed some light on what is happening, I ran the browser and the embedded browser (phonegap) against the W3 mobile web acid test: http://www.w3.org/2008/06/mobile-test/
I definitely notice differences between the two, but I don't yet know the 'why' and the 'how-to-address'.
Acid via built-in browser
(source: eleganttechnologies.com)
BTW - I ran this earlier today and got a couple more green square than just now.
Acid via browser embedded into phonegap
http://www.eleganttechnologies.com/outside/ImgDeviceBb9530PgAcid.jpg
Disclaimer: I don't know anything about phonegap, but have a pretty good theory. By default the embedded browser control on BlackBerry uses an older version of the rendering engine than the BlackBerry browser itself does.
At the BlackBerry developer conference last year, a talk was given about this, and there's an undocumented option to use the newer rendering engine. \
The option ID is 17000 (yes, a magic number, which could change, use at your own risk etc), and should be set to true. Not sure how you'd pass this option through phonegap (I'm not familiar with the toolkit) but using the BlackBerry APIs it's something like:
BrowserContent content;
...
content.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, 17000, true);
I don't know the specifics of the browsers you are using, but I do know that most of the big sites will detect your OS + browser combination to decide what HTML to show you.
If Google is seeing a different user agent, you might get a generic mobile version of the HTML instead os the Blackberry specific HTML you get for the built in browser.
If you have access to a web server, try hitting it with both browser setups and see if there is any difference in the log file. That might tell you something interesting.
As we can see in your Acid tests...
One browser (the built-in one) is reporting correctly as a BlackBerry9530, and the other (phonegap) is not presenting the user-agent ["Testing with ."].
In this case, Google is providing you with the default view of their homepage, whereas when you are reporting yourself as a BlackBerry device, you will get the BlackBerry specific rendering.
By the sounds of things, using phonegap is removing the default user-agent (most probably because it's not recognising your device). As phonegap is open-source, the best bet is to get in there, and debug it and find out what happens with the user-agent when the http requests leave the device and track it back from there.
Maybe one browser has capabilities that another one does not?
Hm. By looking at the screenshot I would say that the second page is probably missing some resources. It may be missing some images, scripts and the CSS files, which would explain different l&f. Knowing how Blackberry Browser Field API works, I would guess that the implementation that uses the BrowserField was not done correctly. Just my guess. In addition to that, when the browser field is initialized the caller needs to configure it properly by enabling the appropriate browser features - scripts, styles etc. Again, the API is done in a very weird way, I have gotten myself into this trap once. When setting the options, you cannot just create one mask (like CSS | WML | SCRIPT) and make one call. Options are numeric and, I believe, non-overlapping - but you still need to call the API for setting each option independently.
Also the way asynchronous loading of the resources for BrowserField takes time to understand.
Just my $0.02.