open url in new window javascript code example
Example 1: javascript open url
window.location.href = "http://example.com/";
Example 2: javascript open new window
<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
Open New Window
</a>
Example 3: open new window javascript
window.open("LINK-HERE");
Example 4: open new window in java script
<script type="text/javascript">
var windowObjectReference = null;
function openFFPromotionPopup() {
if(windowObjectReference == null || windowObjectReference.closed)
{
windowObjectReference = window.open("http://www.spreadfirefox.com/",
"PromoteFirefoxWindowName", "resizable,scrollbars,status");
}
else
{
windowObjectReference.focus();
};
}
</script>
(...)
<p><a
href="http://www.spreadfirefox.com/"
target="PromoteFirefoxWindowName"
onclick="openFFPromotionPopup(); return false;"
title="This link will create a new window or will re-use an already opened one"
>Promote Firefox adoption</a></p>