Javascript redirect - new window

I am trying to create a redirect using Javascript from an empty iframe that will be redirected to a url inside a new window or tab.

In particular, I'm trying to make a Facebook tab on my company’s webpage, and not load the page inside the iframe bookmark, which is not equal to the width of our webpage.

Here is the redirect script I already have, but it does not open the URL in a new window.

<script language="JavaScript">
<!--Redirect to 75th page
var time = null
function move() {
window.location = 'http://philmontscoutranch.org/Camping/75.aspx'
}
timer=setTimeout('move()',0000)
//-->
</script>

Ok - this fragment will open a new window when the page loads, but the Chrome pop-up blocker has blocked it. I have not thought about it so far. Maybe I could load it in a bright window?

<script language="JavaScript">
<!--Redirect to 75th page
var time = null
function open_win()
{
window.open("http://philmontscoutranch.org/Camping/75.aspx", "_blank");
}

timer=setTimeout('open_win()',0000)
//-->
</script>
+5
source share
2 answers

Here you will find: Jsfiddle example

function opennewtab(url){
    var win = window.open(url, '_blank');
}
+8
<html>
<head>
<script>
function open_win()
{
window.open("http://philmontscoutranch.org/Camping/75.aspx", "_blank");
}
</script>
</head>
<body>
<input type="button" value="Open Window" onclick="open_win()">
</body>
</html>

+1

All Articles