Saiid at RLTSquare Saiid at RLTSquare - 5 months ago 47
PHP Question

HTML in new Browser Tab or WIndow

In my PHP file, I have a string variable that contains complete HTML code.

$content = '<html>
<script>--Some javascript and libraries included--</script>
<style>--Some Styling--</style>

I get this in a loop and now I want this HTML to open in new tab or window of browser. With every iteration, there would be a new Tab or Window. I don't think it is possible on server side so may be some JavaScript need to be concatenated to it.


In loop, I've created the URL to hit the controller and set the parameters with it and then simple use the following statement.

echo '<script type="text/javascript">"'. $url .'"); </script>';

and In the $url variable, I created the URL and post data in it. That's how, the new tab will open that hits the url and result will be my complete HTML.