Getting the browser that you are using using Javascript can be important in some cases. Like when reading or setting an element’s property, browsers like IE and Firefox both have different ways to do them. Take for example creating a hyperlink using Javascript. To create the text of the hyperlink, IE uses its proprietary innerText property while Firefox uses textContent (although the specific browser will just ignore the property that it cannot recognize, I feel it’s nice to use browser detection to fully ignore the property even if no error will be thrown). Using the function below can be pretty useful in doing conditional statements on which property to apply to an element. The function is custom made, you can modify it if you wish since my only concern was having to know if the browser was IE or not.

When the iPhone firmware version 2 was released, I was pretty excited about it because Apple finally let developers create games for the device. Before it was only restricted to users being able to use applications that Apple provided. Now, there are lots of games created and one of the games that I anticipated is the Reversi game. It took very long for this kind of game to be cracked but finally it’s been done. Big Bang Games is a collection of classic games like Chess, 4 In A Row, Backgammon, Checkers, Mancala (Sungka in Filipino) and Reversi. These are the same set of games that you see when you have Mac OS installed in your laptop or desktop. I never get bored with Reversi, even if I win 99.9% of the time lolz. I will not explain how each game works since they are classic games and for sure most of you know how they are played or at least have an idea about them. I wished they included a WIFI feature so that you can multiplay with another player. Hopefully, their next version will have this feature (if there will be a next version). The AI (Artificial Intelligence) is decent, although not better than the Nintendo Family Computer version of it (Othello). I’m not complaining though. This is the very first game that I tap right away to play when I get bored. My first wish was granted. I hope my next wishes would become realities. I would love to see a Text Twist, Mummy Maze and those famous Big Fish Games available for the iPhone/iTouch.

When I wanted to get the filename of the file I just uploaded from the HTML form using Javascript, I found out that Internet Explorer and Firefox both output differently (yeah, this is the consequence for always sticking to Firefox). IE outputs the absolute path of the file (this means, it includes the root folder and its subdirectories) while Firefox outputs only the filename. I was expecting even Google Chrome to behave like Firefox but it turned out it gave the same result as IE. If you wish to know if Mac’s Safari browser does output the same as IE and Chrome, then the answer is yes (notice Safari and Chrome’s HTML form file input design is the same? This was done on purpose to avoid a common security flaw). To get around this problem, you would have to check the input file field if there are any \ or / characters in it, and if so, using the lastIndexOf() method to return the position of the occurence of the searched string, use it together with the substring() function. See the function below.

The parameter I used for the function is the id name of the element since I prefer getting elements by id rather than using their form’s names.

Related Posts Plugin for WordPress, Blogger...