Jump to content

Redirecting website to an new tab without hyperlink


Niketa
 Share

Recommended Posts

Hello everyone! I am using a tab/(app) on Facebook to redirect to a website, I have coded it to redirect to a website in a new tab by the ordinary: <a href="https://URL" target="_Blank">Link!</a> In this case one have to click the hyperlink for it to redirect to the new tab. Is there a code that redirects without (cliccking a) hyperlink? Opens in a new tab by just clicking the app? Thank you so much!Niketa

Link to comment
Share on other sites

window.open( 'https://support.wwf.org.uk/earth_hour/index.php?type=individual', '_blank' // <- This is what makes it open in a new window.);That's js, use it in a function and call it onclick of any image, div, word, etc.

Edited by DarkxPunk
  • Like 1
Link to comment
Share on other sites

Thank you so much!Darkxs Punk, Do you know the code for HTML? Manojnaanak, it redirected to open within the same tab and inside the iframe (not even as a full window) is there something to add to the meta for it to redirect into a a new tab Thank you both!

Link to comment
Share on other sites

I will give you this one freebie but learn js!

<!doctype html><html>	<head>		<title>NewTab</title>		<style>#newTab {				margin: 0 auto;				border: 1px solid #000000;				padding: 25px;				width: 50px;				height: 50px;				background: red;				color: #ffffff;			}		</style>		<script>			function newTab() {				window.open(				'about:blank','_blank'				);			}		</script>	</head>	<body>		<div id="newTab" onclick="newTab()">NewTab</div>	</body></html>

the on click can be used on most any element. You can also put the js in the body, but put it before your button.

Edited by DarkxPunk
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...