I am a beginner site developper, first post here. I am posting here because i find this subject particulary difficult to google..
So I was wondering if you surf to a website from 2 different devices, (eg. android / PC ), if a different HTML page is returned..
because sometimes you get like a "simplified" page on the smaller devices.
If so, how can i do this server side? Any handy links/tutorials i can follow? I would work with PHP and MySql.
I am asking this, because I want to develop a site using QR codes, so the biggest number of visitors will be from phones!
Tanks,
Mathias
Take a look at this PHP class.
It detects mobile devices:
http://code.google.com/p/php-mobile-detect/
There are also very simple solutions and tutorials like this one:
Detect mobile browser/user agent with PHP
Searching Google or StackOverflow will give you loads of examples!
Related
I am not sure this is correct SO to post on, but if not admin please feel free to move it to relevant SO or suggest me to move it.
I am using a contractor to help me create a website for some project. He has coded the entire custom website in PHP.
One feature that I requested was that links posted on the website should have the preview feature that we see in Facebook (FB) like in attached picture.
But he keeps saying that I can only use embedded code to create such preview feature. When I show him the FB preview he says FB is probably using technology of its own. Currently if I post the link from youtube to my test website it shows up as text like: https://www.youtube.com/watch?v=jtkUtNzaFPI&t=1909s
My question is:
What exactly is FB using? Is this easy to implement for any PHP developer or is it really time consuming implementation.
"he says FB is probably using technology of its own"
His answer to your question is utter nonsense, and indicates only that he doesn't want to do what you're asking. You hopefully aren't paying him very much.
What Facebook is doing is kind of sneaky, but structurally simple. The order of operations is:
User enters text on Facebook page.
AJAX request is sent to Facebook server with text.
Facebook server parses and sees that there's a link in there.
Facebook server makes a server-side HTTP request to link destination to find out more.
Facebook server parses response for anything it can add to the input template that the user is seeing.
Facebook responds back to user (maybe web sockets? maybe a response to that earlier AJAX request?)
Client-side code on the Facebook page updates what the user is seeing.
Steps 2-6 intuitively sound like they may take a lot of network time, but these tend to be very quick services (Facebook itself, YouTube, etc.) so that's usually not a problem.
The main concern here are Step 3 and Step 5. That's where Facebook is using some custom logic that it likely spent considerable effort defining. There may be libraries which help with that, likely made in response to the demand for this exact feature. I don't have any to recommend, sorry.
The technical implementation is the easy part. Determining from the user's text what data to fetch could be difficult. Determining what data to put in the page could be difficult. That depends on the scope of what you want to implement.
For example, it may be difficult to detect if the user has entered a variety of things you can respond to, but it may be easy (with a regular expression perhaps) to detect if the user has entered what might be a YouTube URL. So if you reduce the problem space to just YouTube previews, then you may be onto something. If you can successfully parse that YouTube link, you're in business. Now you can hit a YouTube API and get information to send back to the page.
Continue with that pattern for other small problem spaces (previewing a link to an image, previewing a link for another popular site, etc.), and you can over time add that same feature.
I wanted to build a real time multi player game using flash (action script 3) as front end and use php as back end language and mysql database. There are lot of posts and tutorials online, but nowhere I found an article which would suffice my requirement.
I thought of using smartfox server. But lately they are not supporting php backend technology. Here is the answer by their technical person.
http://www.smartfoxserver.com/forums/viewtopic.php?f=18&t=15791
This seemed to be a useful post, but it didn't give me complete information as to handle the game play with php back end.
http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/
Do we have to use web sockets in front end. And how to handle the user's delay on the website. Also I am supposed to use Facebook Login to get more users on the game.
My game should have multiplayer feature just like this one on facebook.
https://apps.facebook.com/livepool/
Can someone suggest me on this please.
How to record user's voice from the website without Flash? I want to use HTML5 but I found it will be hard to implement that. This site says this functionality is now only supported by the latest version of Chrome and Opera.
After searching the articles both here and the other site, I decide to find an alternative approach.
The scenario is: users will use different sort of platform (Android/iOS and other OS), but they access the same website and record their voice in their device and upload it later.
BTW: My purpose is that, as the users press the "Record" button on my web-page, the recording starts with his microphone. And as he presses the button again, the process stops. This can be on an iPad or a mobile phone so that he can't record his voice by some other software and store in his device then upload. They use their device to link my web-page to record voice. The webpage is not just for the users who operate on a PC.
Can I implement this function in client side via javascript? Or I should refer to Server side? What language and method should I adopt?
You can check google's web fundamental article on recording audio here : https://developers.google.com/web/fundamentals/media/recording-audio/
Its pretty easy to follow and it is device independent, obviously given correct browser support. You can get the audio recorded and saved on the local device or upload it to a server. Hope it helps.
oh, and on a note, its based on HTML5 and js. I don't know why you think implementing it using HTML5 is difficult but I hope this helps.
If it was up to me, I'd go for something like the link mentioned above and just use a fallback to Flash applet if its not supported in the users browser.
When it comes to the mobile platform, you'll have a big problem at least with the iPhone. I dont think you can upload files, and Iam pretty certain that you cannot record audio from their microphone. The best approach would be an application to do such a thing on mobile devices. Iam pretty sure that this can be done with PhoneGap - http://docs.phonegap.com/en/1.0.0/phonegap_media_capture_capture.md.html
If your not familiar with PhoneGap it allows you to write cross platform applications for mobile devices in HTML/CSS/JS and still get access to some core components. Like capturing audio.
Unfortunately no, you can't record from the browser, however, if you have an app (you can use Phonegap/Cordova (which use HTML5, JS and CSS to build your app for many platforms)) to record whatever you want to record, you can easily upload what you want to your server. It is currently impossible to use pure HTML5 in the mobile web browser to do this.
If you want to learn more about this, the API reference is a good start: http://docs.phonegap.com/en/2.1.0/cordova_media_capture_capture.md.html#capture.captureAudio
I'm creating a social networking site for books (like Goodreads) and I'd like to include a feature whereby a user can scan the barcode of a book using the webcam and get information about that book.
The functionality for finding the information is already complete. I just need to know how to make the webcam read the ISBN and output it as a string, which I can then feed into my script which fetches the information. At the moment this is just done by filling in a form with the IBSN.
My website is built using PHP.
I can't seem to find a working solution online.
Any ideas of how I could go about implementing this?
Idea would be to use Flash barcode scanner. I've seen flash software that recognizes gestures and so on, so barcode shouldn't be that hard.
Here you can see it implemented: http://gurulib.wordpress.com/2007/12/28/a-flash-based-webcam-barcode-reader/
I was wondering if it was possible to have two or more sets of Google Analytics tracking codes on one page. There's going to be a single webpage that is accessible through either normal methods (desktop or mobile browser), or accessed through scanning the QR code on the product packaging and being redirected that way.
The client wants three things tracked:
Analytics for the full page (all methods of connection)
Analytics for just those connected via normal methods
Analytics for those connected via QR code
I have already developed a means of differentiating the connection method, and switching the Google provided Javascript for 2 and 3.
So is this possible, to have two analytics codes on one page? I have checked all over, can't find an answer that is to the point.
Thanks in advance
A single analytics will report browser and OS used and the origin of traffic. Hence, there's no reason to use three cookies, three JS files when you can just generate a personalized report with the data you need
Don't use different trackers for this, use custom variables. Splitting it up loses you valuable insight into how different use cases navigate the site.
If anyone is ever looking for this:
http://www.publicinsite.com/qr-codes-google-analytics-track-mobile-devices/
That;s the best bet I think