Programming

Programming

Useful Javascript Snippets

Get the current URL var my_url = document.URL; Get the root URL var my_root_url = location.protocol + ‘//’ + location.host; Get a Hash Parameter from a URL var my_parameter = document.URL.split(‘#’)[1]; Redirect a page to another page window.location.href = ‘http://www.yourpageofchoice.com’;

Read More
Programming

How to truncate long texts using CSS (text-overflow)

Using a back-end language to cut long strings is not always the best solution. Consider that a variable amount of space (on desktop the space would be bigger; on mobile devices it would be smaller) needs to be filled with some text. PHP, Ruby etc. will be ignorant of the actual size of the space […]

Read More