Avatar of Foffaf Foffaf
Foffaf Foffaf
Flag for Indonesia asked on

How to execute php and use javascript to open a URL in new tab?

Hi,

I have this code in testaja.php:


<?php
echo
"<script type=\"text/javascript\">
   window.open('https://docs.google.com/spreadsheets/d/1xLFUO/edit#gid=0', '_blank');
</script>";
?>


I want to execute the php and hopefully the script run and open the URL in new tab/window.
But browsers always blocked it.
Any recommendations?
I don't want to tell my users to open browser settings and allow pop-ups and redirects.

PHPJavaScript

Avatar of undefined
Last Comment
David Johnson, CD

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Michel Plungjan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
David Johnson, CD

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck