Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Reinier de Graaf
IE redirect to Home
November 28, 2007 4:25 AM
Answer

Reinier de Graaf

Rank: New Member

Posts: 15

Join Date: October 25, 2007

Recent Posts

Hi,

I've made a portlet that allows a user to create a guest account and
automatically log in. It works perfectly in Firefox:
- It creates a user account, given a certain name
- posts the user & password to the login portlet at /c/portal/login
- then it logs in and redirects to the portal's front page.

However in Internet Explorer the user is not redirected to ../web/guest,
but stays at /c/portal/login/

Does anyone know how I can make the redirect work in IE?

Here's the form and javascript code in the xhtml file:

<body onload="submit_form()">
<h:form name="loginRedirect" method="post" action="/c/portal/login">
<input name="cmd" type="hidden" value="already-registered" />
<input name="tabs1" type="hidden" value="already-registered" />
<input name="redirect" type="hidden" value="true" />
<input name="rememberMe" type="hidden" value="false" />
<input type="hidden" name="login" value="#{guestLoginMB.email}"/>
<input type="hidden" name="password" value="test"/>
<!--<div>A liferay user has been created.</div>
<h:outputText value="email" /> :
<h:outputText value="#{guestLoginMB.email}" />
<div><h:commandLink action="back">back</h:commandLink></div>-->
</h:form>

//<![CDATA[
function submit_form()
{
//We need to find the form of our Guest Portlet, since it's id is changed by Liferay or Tomcat.
forms = document.getElementsByTagName('form');

for (i in forms) {
if(forms.id) {
if(forms.id.indexOf('guest_login_portlet') > 0) {
guestPortletId = forms.id;
break;
}
}
}

//Redirect to login page with login information
document.getElementById(guestPortletId).action="/c/portal/login";
document.getElementById(guestPortletId).submit();
}
//]]>

</body>