PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, March 5, 2022

[FIXED] PHP - open a link, in a new window?

 March 05, 2022     codeigniter, php     No comments   

Issue

Sorry if this is blatantly obvious, but I've Googled this and I seriously cannot find any PHP-only way to do it.

Without using an HTML or Javascript - pure PHP only (from a Controller file in a CodeIgniter site) - how can I open a browser window with a link I specify?

Is it possible?

Thanks!

Edit: it seems some people are misinterpreting what I mean, I apologise for not making it clear enough. I know with PHP you can set header("Location: http://example.com") to make the browser load a new window; I wanted to know if it was possible to send a header to say "open the Location in a new window".

Edit 2: to clarify what I want to do: the user can submit something to my site. Before clicking 'Submit', they can opt (via checkbox) to Tweet about it. If the checkbox is ticked, after everything's inserted into the database etc. a new window/tab loads with the URL http://twitter.com/home?status=Hello%20World or whatever the tweet will say. The user will have opted to do this so I'm not "doing something I shouldn't". I understand in hindsight though, that there probably is a better way of doing this.


Solution

You can't use a server-side language (PHP) to control client-side behavior (forcing a new browser window for a hyperlink).



Answered By - BoltClock
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing