Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Monday, March 22, 2010

Get the URL with Javascript

It's good to get questions from your work colleges, and specially those you can't answer right away, so you're forced to do some research.

Today one person asked me if I know a way to get the URL of a page using Javascript. I don't recall doing it before. With PHP (and its $_URL, $_POST, $_REQUEST, $_SERVER, etc variables) I never needed of JS for such task.

But it's always useful to know it and have code like the following handy:

function getHost() {
var url = window.location;
var urlparts = url.split('/');
var host = urlparts[0];
alert(host);
}

Credits go to CNET.

Monday, January 25, 2010

JS Beautifier

Have some code with no indentation or breaklines? Try this tool:

http://jsbeautifier.org/

It will clean your code ;)

Friday, December 5, 2008

Books I recommend

PHP & MySQL
  • Beginning PHP5 and MySQL5 - From Novice to Professional-2e-2006-APress
  • Professional Ajax Php
  • Professional LAMP - Linux, Apache, MySQL, & PHP5 Web Development (2006)
Javascript
  • Javascript Bible 4th Edition
  • O'reilly - Javascript - The Definitive Guide, 4th Edition
Ajax


HTML, XML and others -ML
  • OReilly XML Pocket Reference 2nd