Opening new window with Given URL |

Hi Yii members,

i have encountered a problem on loading a new url in method.

what i wanted is, when i give something like below.‘’, ‘window name’, ‘window settings’);

i wanted the to be loaded on a new tab. but sadly what happens is its loading the facebook url wrongly. this way… http://localhost/mysite/index.php/admin/coupon/[color="#FF0000"][/color]

i tried all ways but unfortunately still i am getting the same page which is a wrong url. when i do the same in a new php page it is loading and working well. but inside yii when i call method its appending to the current url like i said before.

can anyone please explain me why this happens in yii ?

any help would be highly appreciated.



what are you use for operation? ( simple core html or Yii CHtml format ?)

can you post your code?

use this,

<?php echo CHtml::link('Link Text','', array('target'=>'_blank')); ?>

its a simple javascript.

the code is as follows.

//test fb url


      var fburl = &#036;('#fb_url').val();, 'window name', 'window settings');

	  return false;


when the user clicks the link which has the id #fbtesturl it will take the given url from text box and open it on a new tab.

i want to load the relative url. but i dont understand why its taking the absolute url. which is something like this… http://localhost/mys...p/admin/coupon/[color="#FF0000"][/color]

where it must be just… :(

thanks for you comments. pls let me know weather you know a way to fix this. tnx


here i had created simple demo with yii CHtml elements and simple javascript;

javascript open new window with url specified in textbox.


function test(){

	var url = document.getElementById('test').value;;



Below is link and textbox, clicking on link it will open the url in new window which is specified in textbox : use url with http ( i.e: )

Link code below


echo CHtml::link("test", '#', array ('onClick'=>'test();' ))


Textbox code below

<?php echo CHtml::textField('Text', '',




   	'maxlength'=>100)); ?>

above is flow and idea, you can modify in way as you want.

[size="3"]Hey Kiran really appreciate you help. i found the bug and it was my mistake.

i have forgotten to include the http:// along with the url.

when i give so, it worked like a princess.

many thanks[/size]