I have the following part of code in a PHP file and I want to know if there's a way to make the URL open in a new window instead of the same window. It might be a dumb or easy question, but I'm not too familiar with PHP

header("Location: http://www.website.com" );

Let me know if this is possible, and if so, how. Thanks.

Recommended Answers

Can't do that with PHP. You'll need JavaScript for that.

Jump to Post

All 4 Replies

Can't do that with PHP. You'll need JavaScript for that.

Can't do that with PHP. You'll need JavaScript for that.

How could I do it with javascript?

Well, if you have to communicate with a server-side script you will need to use ajax to have the server do that work and then return whether or not it was successful or not. If it was successful just use window.open() to open a new window.

This can be easily done using javascript

window.open('http:list.2lessons.com','_blank');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.