Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript redirect - New Window

I'm trying to create a re-direct using Javascript from inside a blank iframe that will direct to a URL inside a new window or tab.

More specifically, I'm trying to make a Facebook tab point to my company's webpage rather than load the page inside the tab's iframe which is not the same width as our web page.

Here is the redirect script I already have but it doesn't 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 snippet will open a new window when the page loads but Chrome's pop-up blocker blocked it. I didn't think about this until now. Maybe I could have it load in a light 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>
like image 577
user2132731 Avatar asked Mar 04 '13 17:03

user2132731


People also ask

How do I redirect a new tab?

open : window. open("someurl", "_blank"); On most browsers with default settings, that will open a new tab rather than a new window.

Can we redirect a page using JavaScript?

It is quite simple to do a page redirect using JavaScript at client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows.

How do I redirect to another page?

How to Redirect to Another Page in HTML. To redirect one HTML page to another page, you need to add a <meta> tag inside the <head> section of the old HTML page. The <head> section of an HTML document contains metadata that is useful for the browser, but invisible to users viewing the page.


1 Answers

Here you go: Jsfiddle Example

function opennewtab(url){
    var win = window.open(url, '_blank');
}
like image 168
Zachrip Avatar answered Sep 18 '22 19:09

Zachrip