Redirect, Refresh, Access the URL of the Current Page in JavaScript

Redirect, Refresh, Access the URL of the Current Page in JavaScript

JavaScript’s location object

Redirect, Refresh, and Access the URL of the Current Page in JavaScript. JavaScript’s location object

We can use the window.location property to access the URL of the current page and modify it.

let location = window.location;

For redirecting the page we can use:

location.href = "new url";

// or we can use 

location.assign("new url");

For redirecting without storing in history:

location.replace("new url"); 

For reloading the page:

Force refresh

We can pass true to force the reloaded page to come from the server (instead of the cache). Alternatively, we can use false to reload the page from the cache.

//from cache

// from server
Properties of Location Object

1. Href

Contains the entire URL of the page.

location.href; // current page url addresss

When we assign a new value to the property, it will redirect the url value set to the property.

location.href = ""; 

Make sure to add http/https. Otherwise, it makes the request on the same page.

2. Protocol

Contains the protocol (http,https,...) of the page.

location.protocol; // https:

3. Host

Website hostname with port number.; // 

// with port number 

var anchor = document.createElement("a");
anchor.href = " // "medium:4097"

4. Hostname

Website hostname.; //

5. Port

Contains the port number. If the URL does not contain an explicit port number, it will be set to ''.

var anchor = document.createElement("a");
anchor.href = "
anchor.port // "4097"

6. Pathname

Contains the path after the hostname.

location.href; //

location.pathname; // "/@jagathishsaravanan"

7. Search

Returns the search part of URL.

I am on page;; // ?q=javascriptjeep
8. Hash

Contains string of '#' followed by the fragment identifier of the URL. This will be useful when we have links inside the same page.

Example from MDN Web Docs:

<a id="myAnchor" href="/en-US/docs/HTMLHyperlinkElementUtils.href#Examples">Examples</a>

  var anchor = document.getElementById("myAnchor");
  console.log(anchor.hash); // Returns '#Examples'

9. Origin

Origin of specific location.

consider we are at page :

location.origin; //

1. assign

Loads the resource at the URL provided in the parameter.


This will redirect to

2. reload

The **Location.reload()** method reloads the current URL, like the Refresh button.


It has an optional parameter forceReload, which defaults to false when forceReload is true. Then it loads the page from the server, instead of loading from the browser cache.


3. replace

Replaces the current resource with the one at the provided URL.

// consider we are

// when we run this line 


// it will replace the current page and redirect to medium page

The difference from the assign() method is that after using replace(), the current page will not be saved in session History, meaning the user won't be able to use the Back button to navigate to it.

4. toString

Returns the whole URL as a string.



Thank you for reading ! I hope this tutorial will surely help and you if you liked this tutorial, please consider sharing it with others.

Top 19 Front-End Web Development Tools to Consider in 2020

Top 19 Front-End Web Development Tools to Consider in 2020

In this post, we are putting curated list of top tools with key features and download links "Top 19 Front End Web Development Tools to Consider in 2020"

Front-End development is one of the critical skill for web developers as there is a lot of demand for programmers with excellent front-end development skills.

If you've never experienced client-side web development, learning the plethora of front-end technologies can be difficult, but you can achieve your target.

The one thing which I want to tell you that a good knowledge of HTML, CSS, and JavaScript is a must for any front-end developer. Even though we are living in the era of frameworks and libraries, but knowledge of these fundamental technologies cannot be undermined.

In this post, we are putting curated list of top tools with key features and download links "Top 19 Front End Web Development Tools to Consider in 2020"

1. TypeScript:

TypeScript is an open-source front end scripting language. It is a strict syntactical superset of JavaScript which adds optional static typing. It is specially designed for development of large applications and compiles to JavaScript.


  • TypeScript supports other JS libraries
  • It is possible to use this Typescript on any environment that JavaScript runs on
  • It supports definition files that can contain type information of existing JavaScript libraries, such as C/C++ header files
  • It is portable across browsers, devices, and operating systems
  • It can run on any environment that JavaScript runs on

Download link:

2. Backbone:

Backbone.js gives structure to web applications by offering models with key-value binding and custom events.


  • Backbone.js allows developers to develop one-page applications
  • Backbone.js has a simple library used to separate business and user interface logic
  • This tool makes code simple, systematic and organized. It acts as a backbone for any project
  • It manages the data model which also includes the user data and display that data on the server side
  • It allows developers to create client side web applications or mobile applications

Download link:

3. jQuery:

jQuery is a widely used JavaScript library. It empowers front-end developers to concentrate on the functionality of different aspects. It makes the things easy like HTML document traversal, manipulation, and Ajax.


  • QueryUI facilitates to make highly interactive web applications
  • It is open source and free to use
  • It provides a powerful theme mechanism
  • It is very stable and maintenance friendly
  • It offers an extensive browser support
  • Helps to create great documentation

Download link:

4. AngularJS:

AngularJS is another must-have tool for front-end developers. It is an open-source web application framework. It helps to extend the HTML syntax for web applications. It simplifies front-end development process by developing accessible, readable and expressive environment.


  • It is an is open source, completely free, and used by thousands of developers around the world
  • It offers to create RICH Internet Application
  • It provides option to write client side application using JavaScript using MVC
  • It automatically handles JavaScript code suitable for each browser

Download link:

5. HTML5 Boilerplate:

HTML5 Boilerplate help in building fast, robust, and adaptable web apps or sites. It is a set of files that developers can download, which provide a foundation for any website.


  • It allows developers to use HTML5 elements
  • It is designed by keeping progressive enhancement in mind
  • Normalize.css for CSS normalizations and common bug fixes
  • Apache Server Configs to improve performance and security
  • It offers optimized version of the Google Universal Analytics snippet
  • Protection against console statements causing JavaScript errors in older browsers
  • Extensive inline and accompanying documentation

Download link:

6. ONE Subscription

ONE Subscription is an effective web-development kit that allows getting access to a great number of top-quality digital products. It boasts tons of high-quality items that make it possible to launch fully-fledged blogs, online-stores, landing pages, and other websites. In general, you will be provided with thousands of themes and templates, different plugins and graphic elements, additional services, and other advantages.


  • professional support for all items;
  • regular updates;
  • security (you can easily cancel your subscription within 14 days after its starts if you have not downloaded anything from the database);
  • unlimited yearly license;
  • useful services (as an example, template customization or installation).

Download link:

7. Npm:

Npm is the Node package manager for JavaScript. It helps to discover packages of reusable code and assemble them in powerful new ways. This web development tool is a command-line utility for interacting with a said repository that aids in the package.


  • Discover and reuse over 470,000 free code packages in the Registry
  • Encourage code discovery and reuse within teams
  • Publish and control access to namespace
  • Manage public and private code using the same workflow

Download link:

8. CodeKit:

Codekit is a front-end web development tool. This tool provides support to build websites faster. It combines, minifies and syntax-checks JavaScript. It also optimizes images.


  • CSS changes are injected without need of reloading the entire page
  • Combine scripts to reduce HTTP requests.
  • Minify code to reduce file sizes
  • Works automatically with most languages without trouble

Download link:

9. Sass:

Sass is the most reliable, mature, and robust CSS extension language. This tool helps to extend the functionality of an existing CSS of a site like variables, inheritance, and nesting with ease.


  • It is straightforward and easy to use front end tool to write any code
  • Supports language extensions such as variables, nesting, and mixins
  • Many useful functions for manipulating colors and other values
  • Advanced features like control directives for libraries
  • It offers well-formatted, customizable output

Download link:

10. WebStorm:

WebStorm brings smart coding assistance for JavaScript. It provides advanced coding assistance for Angular, React.js, Vue.js and Meteo. It also helps developers to code more efficiently when working with large projects


  • WebStorm helps developers to code more efficiently when working with large projects
  • It provides built-in tools for debugging, testing and tracing client-side and Node.js applications
  • It integrates with popular command line tools for web development
  • Spy-js built-in tool allows tracing JavaScript code
  • It provides a unified UI for working with many popular Version Control System
  • It is extremely customizable to perfectly suite various coding style
  • It offers built-in debugger for client-side code and Node.js apps

Download link:

11. Chrome Developer Tools:

The Chrome Developer Tools are a set of debugging tools built into Chrome. These tools allow developers to do wide varieties of testing which easily saved lots of time.


  • It allows adding custom CSS rules
  • Users can view Margin, Border, and Padding
  • It helps to Emulate Mobile Devices
  • Possible to use dev tools as editor
  • User can easily disable browser's caching when dev tool is open

Download link:

12. Grunt:

Grunt is a popular task runner on NodeJS. It is flexible and widely adopted. It is preferred tool when it comes to task automation. It offers lots of bundled plugins for common tasks.


  • It makes the workflow as easy as writing a setup file
  • It allows automating repetitive tasks with minimum effort
  • It has a straightforward approach. It includes tasks in JS and config in JSON
  • Grunt includes built-in tasks for extending the functionality of plugins and scripts
  • It speeds up the development process and increase the performance of projects
  • The ecosystem of Grunt is huge; so it is possible to automate anything with very less effort
  • This web development tool reduces the chance of getting errors while performing repetitive tasks

Download link:

13. CodePen:

CodePen is a web development environment for front-end designers and developers. It is all about faster and smoother development. It allows to build, deploy website and build test cases.


  • It offers to build components to use elsewhere later
  • It includes some awesome features to write CSS faster.
  • Allows live view and live sync
  • Prefill API feature allows adding links and demo pages without need to code anything

Download link:

14. Jasmine:

Jasmine is a behavior-driven js for testing JavaScript code. It does not depend on any other JavaScript frameworks. This open source tool does not require a DOM.


  • Low overhead, no external dependencies
  • Comes out of the box with everything need to test code
  • Run browser tests and Node.js tests using the same framework

Download link:

15. Foundation:

Foundation is front-end framework for any device, medium, and accessibility. This responsive front-end framework makes it easy to design responsive websites, apps, and emails.


  • It offers the cleanest markup without sacrificing the utility and speed of Foundation
  • Possible to customize the build to include or remove certain elements. As it defines the size of columns, colors, font size.
  • Faster development and page load speed
  • Foundation is optimized truly for mobile devices
  • Customizability for developers of all levels
  • It takes responsive design to the next level, with the much-needed medium grid accommodating for tablets

Download link:

16. Sublime Text:

Sublime Text is a proprietary cross-platform source code editor. This app development tool natively supports many programming languages and markup languages.


  • Command palette feature allows matching keyboard invocation of arbitrary commands
  • Simultaneous editing allows making the same interactive changes to multiple areas
  • Offers Python-based plugin API
  • Allows developers to give project specific preferences
  • Compatible with many language grammars from TextMate

Download link:

17. Less

Less is a pre-processor that extends the support for CSS language. It allows developers to use techniques to make CSS more maintainable and extendable.


  • It can freely download and use
  • It offers higher-level style syntax, which allows web designers/developers to create advanced CSS
  • It easily compiles into standard CSS, before the web browser begins rendering a web page
  • Compiled CSS files can be uploaded to the production web server

Download link:

18. Modaal:

Modal is front end development plugin which gives quality, flexibile, and accessibile modals.


  • Optimized for assistive technologies and screen readers
  • Fully responsive, scaling with browser width
  • Customizable CSS with SASS options
  • It offers full-screen and viewport mode
  • Keyboard control for gallery open and closing modal
  • Flexible close options and methods

Download link:

19. Github:

GitHub is a web development platform inspired by the way you work. This tool allows developers to review code, manage projects, and build software.


  • Coordinate easily, stay aligned, and get done with GitHub's project management tools
  • It offers right tools for the job
  • Easy documentation alongside quality coding
  • Allows all code in a single place
  • Developers can host their documentation directly from repositories

Download link:

Thank for reading!

6 Front-End Challenges in 2020

6 Front-End Challenges in 2020

Front-end development is stressful and hard — but with practice, one can master the craft. If you’re willing to put the work and effort in, you’ll be able to become a proficient problem solver in the front-end development landscape. One effective way to become a great front-end developer is to simply build and solve as many challenges as one can. Here Are 6 Front-End Challenges to Code. Are you able to code These front-end challenges?

Front-end development is stressful and hard — but with practice, one can master the craft. If you’re willing to put the work and effort in, you’ll be able to become a proficient problem solver in the front-end development landscape. One effective way to become a great front-end developer is to simply build and solve as many challenges as one can.

Here are six challenges you can start solving today to become a master of front-end development. Without further ado, here are the six challenges you probably should code.

1. Credit Card Form

A fantastic credit card form with smooth and sweet microinteractions. Includes number formatting, validation, and automatic card-type detection. It’s built with Vue.js and also fully responsive.

credit-card-form —

What you’ll learn by solving the challenge

  • Form handling and validation
  • Handling event listeners (e.g., when the fields change, it’ll print the values on the credit card)
  • Understanding how to display and position elements on the page, especially the credit card overlapping the form
2. Bar Chart From Scratch

A bar chart or bar graph is a chart or graph that presents categorical data with rectangular bars with heights or lengths proportional to the values they represent.

The bars can be plotted vertically or horizontally. A vertical barchart is sometimes called a line graph.

What you’ll learn by solving the challenge

  • Display data in a structured and easily understandable way
  • Optional: Learn how to use the `` element and how to draw elements with it

You can find the data for the world population by year here.

3. GitHub Repositories With Search Functionality

Nothing out of the world here — GitHub repositories are basically just a glorified list.

The task is to display the repositories and allow the user to filter through the repositories. Use the official GitHub API to fetch repositories per user.

GitHub profile page —

What you’ll learn by solving the challenge 4. Twitter Heart Animation

Back in 2016, Twitter introduced this awesome animation for their tweet likes. As of 2019, it still looks rad, so why not create one yourself?

Twitter tweet like animation

What you’ll learn by solving the challenge

  • How the keyframes CSS attribute works
  • How to manipulate and animate HTML elements
  • How to combine JavaScript, HTML, and CSS
5. Reddit-Style Chat Rooms

Chat rooms are a popular way of communicating thanks to being easy and fun to use. But what actually powers modern-day chat rooms? WebSockets!

What you’ll learn by solving the challenge

  • How to use WebSockets and real-time communication and data updates
  • How user permissions levels work (e.g, the owner of a chat channel has the role of admin, while others in the room have the role of user)
  • Form validation and handling — remember, the chat box for sending a message is an input element
  • How to create and join different chat rooms
  • Direct messages and how they work. Users can communicate with other users privately. Essentially, you’ll be establishing a WebSocket connection between two users.
6. Stripe-Style Navigation

What’s unique about this navigation is the popover container morphs to fit the content. There’s an elegance to this transition versus the traditional behavior of opening and closing a new popover entirely.

Stripe navigation

What you’ll learn by solving the challenge

  • How to combine CSS animations with transitions
  • Cross-fading content and applying the active class for the element being hovered

Try doing it first yourself, but if you need help, check out this post for a step-by-step guide.


Remember, there are no shortcuts when it comes to getting good at coding. Start putting the work in, and boost your coding skills by building as much as you can. If you didn’t find anything interesting, check the post below for even more ideas.

Thanks for reading — hope you found something interesting to code.

Window.console in JavaScript

Window.console in JavaScript

In JavaScript, window.console or console object is under-rated with only console.log() being used most of the time. However, the console object comes with a lot of advanced features. In this article, we will be discussing the functions available on the console that can be handy at times.

In JavaScript, window.console or console object is under-rated with only console.log() being used most of the time. However, the console object comes with a lot of advanced features.

In this article, we will be discussing the functions available on the console that can be handy at times.

A deeper look into the console

Besides console.log(), there are a lot of other methods also available. You can try looking for the suggestions list in the browser’s console.


console.log() is the most commonly used function in JavaScript to log values. It just logs/prints the value that is passed to the function.

We can also concatenate multiple values using console.log(). Simply call console.log() with multiple parameters and all the values will be concatenated.

You can even pass multiple objects and the browser’s console will show them side by side.

Following are some of the examples of concatenation with console.log:


While console.log() can be used to print an object, we can also use console.table() to pretty print an object in the form of a table.

Just pass the object to print the object in a more readable format.

Notice, how it prints the values for the nested object.


It is used to print warning messages in the browser’s console.


It is used to print error messages in the console.


This can be used to calculate the time elapsed by our code to execute.

Before starting the execution of any operation, start the timer with console.time(‘TIMER_NAME’) and after the execution of the code, end the timer with console.timeEnd(‘TIMER_NAME’).

As soon as you call the timeEnd function, the elapsed time will get printed in the console.

The timer name should be same for time() and timeEnd()


This command is used to clear the console.

Running the last command resulted in the console being cleared with the following message.

Thank you for reading !