how to open a url with javascript code example Example: javascript open url window.location.href = "http://example.com/";