Jump to content

Redirect page inside iframe to opening in new page


samerhannoun

Recommended Posts

Dear All, I working with 2 CMS Joomla + elgg, I make an iframe in joomla home page to view the login box of elgg social engine but when the user login the joomla page still loaded and the content of iframe contains the new elgg page.this the code in the joomla page:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"><!--#container{ width:236px; height:238px; border:0px solid #000; overflow:hidden; margin:auto;}#container iframe { width:490px; height:452px; margin-right:-216px; margin-top:-160px; border:0 solid; }--></style></head><body><div id="container"><iframe src="http://localhost/elgg" scrolling="no"></iframe></div></body></html>

Link to comment
Share on other sites

Add target="_blank" to the <form> tag in the elgg login script.
hi frnd,thank u for ur quick response i have try it and its ok when the user perform login task a new page opened in a new browser pageI want it in the same browser page, I try with _parent ,_self,_top but not working?what do u think?
Link to comment
Share on other sites

That's going to be a bit more advanced.You could use Javascript to change the url of the "parent" window, but I don't think you can change the "parent" window from within the iframe, since it is its own parent...

Link to comment
Share on other sites

That's going to be a bit more advanced.You could use Javascript to change the url of the "parent" window, but I don't think you can change the "parent" window from within the iframe, since it is its own parent...
So can you tell me from where can I start to solve this problem?
Link to comment
Share on other sites

Using either "_top" or "_parent" should work just fine.An iframe is not its own parent, it is only itself ("_self")If using "_parent" or "_top" are not working, maybe you could show us the code that's in the iframe to see what's wrong.

Link to comment
Share on other sites

Using either "_top" or "_parent" should work just fine.An iframe is not its own parent, it is only itself ("_self")If using "_parent" or "_top" are not working, maybe you could show us the code that's in the iframe to see what's wrong.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"><!--#container{width:236px;height:238px;border:0px solid #000;overflow:hidden;margin:auto;}#container iframe {width:490px;height:452px;margin-right:-216px;margin-top:-160px;border:0 solid;}--></style></head><body><div id="container"><iframe src="http://localhost/elgg" scrolling="no"></iframe></div></body></html>this is the code man
Link to comment
Share on other sites

But where is the form?
this below code for the form class <?php/** * Create a form for data submission. * Use this view for forms rather than creating a form tag in the wild as it provides * extra security which help prevent CSRF attacks. * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ * * @uses $vars['body'] The body of the form (made up of other input/xxx views and html * @uses $vars['method'] Method (default POST) * @uses $vars['enctype'] How the form is encoded, default blank * @uses $vars['action'] URL of the action being called * @uses $vars['js'] Any Javascript to enter into the form * @uses $vars['internalid'] id for the form for CSS/Javascript * @uses $vars['internalname'] name for the form for Javascript * @uses $vars['disable_security'] turn off CSRF security by setting to true */if (isset($vars['internalid'])) { $id = $vars['internalid'];} else { $id = '';}if (isset($vars['internalname'])) { $name = $vars['internalname'];} else { $name = '';}$body = $vars['body'];$action = $vars['action'];if (isset($vars['enctype'])) { $enctype = $vars['enctype'];} else { $enctype = '';}if (isset($vars['method'])) { $method = $vars['method'];} else { $method = 'POST';}$method = strtolower($method);// Generate a security header$security_header = "";if (!isset($vars['disable_security']) || $vars['disable_security'] != true) { $security_header = elgg_view('input/securitytoken');}?><form <?php if ($id) { ?>id="<?php echo $id; ?>" <?php } ?> <?php if ($name) { ?>name="<?php echo $name; ?>" <?php } ?> <?php echo $vars['js']; ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>" <?php if ($enctype!="") echo "enctype=\"$enctype\""; ?> target="_self"><?php echo $security_header; ?><?php echo $body; ?></form>*********************here will be the login process <?php/** * Elgg login action * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ */// Get username and password$username = get_input('username');$password = get_input("password");$persistent = get_input("persistent", false);// If all is present and correct, try to log in$result = false;if (!empty($username) && !empty($password)) { if ($user = authenticate($username,$password)) { $result = login($user, $persistent); }}// Set the system_message as appropriateif ($result) { system_message(elgg_echo('loginok')); if (isset($_SESSION['last_forward_from']) && $_SESSION['last_forward_from']) { $forward_url = $_SESSION['last_forward_from']; unset($_SESSION['last_forward_from']); forward($forward_url); } else { if ( (isadminloggedin()) && (!datalist_get('first_admin_login'))) { system_message(elgg_echo('firstadminlogininstructions')); datalist_set('first_admin_login', time()); forward('pg/admin/plugins'); } else if (get_input('returntoreferer')) { forward($_SERVER['HTTP_REFERER']); } else { forward("pg/dashboard/"); } }} else { $error_msg = elgg_echo('loginerror'); // figure out why the login failed if (!empty($username) && !empty($password)) { // See if it exists and is disabled $access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); if (($user = get_user_by_username($username)) && !$user->validated) { // give plugins a chance to respond if (!trigger_plugin_hook('unvalidated_login_attempt','user',array('entity'=>$user))) { // if plugins have not registered an action, the default action is to // trigger the validation event again and assume that the validation // event will display an appropriate message trigger_elgg_event('validate', 'user', $user); } } else { register_error(elgg_echo('loginerror')); } access_show_hidden_entities($access_status); } else { register_error(elgg_echo('loginerror')); }}ok
Link to comment
Share on other sites

So you say you've been setting the target to "_top" and it's not working?I don't see why it shouldn't work. What does the output HTML look like?
dear,what do u mean by what is the output of html,, when the user PERFORM login task a new tab browser is opening.I don't know y?I want the page opened in the same window
Link to comment
Share on other sites

Hi all,, The problem had been solved, the solution may be let you go bananawhen I edit the source code I have use OpenOffice writer and the double qouts with OpenOffice not like double qouts in Notepad. Just this the problem.I have open the file with notepad and edit it and the code run okey.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...