Rithu
Rithu

Reputation: 1289

Giving href url location for parent window from child window

When I click logout in my page, it calls the logout.php for twitter logout. The below coding opens the twitter logout window in a child window and refreshes the same parent window for logout.

Also the user clicks the signout button in child window, they are logged out from twitter. What I want to do here is, have to give a URL for the parent window when it refreshing.

When the parent window refreshes, it stays the URL "www.example.com/sitename/index.php".

I want to change the URL as "http://example.com/sitename/index.php". Since I had a problem with URL starts with WWW in my site

Anybody can help me to solve this issue. Thanks in advance

Logout.php

<?php
include("header.php");
    header("Location:https://twitter.com/#!/logout");
?>

<script>

function refreshParent()
{

  window.opener.location.href = window.opener.location.href;

  if (window.opener.progressWindow)

  {
    window.opener.progressWindow.close()
  }
    window.close();
}
</script>

Upvotes: 1

Views: 1162

Answers (2)

Rithu
Rithu

Reputation: 1289

The solution for the problem is giving URL when we click the logout in main page. We have to give the coding below when we write coding for session destroy

<meta http-equiv="refresh" content="2;url=<?php echo URLPATH;?>">

This URLPATH is our mentioned URL so that after logout the parent window get refreshed with this URL and no need to write function seperately

Upvotes: 0

Kashif Naseem
Kashif Naseem

Reputation: 166

You can put these lines in your root .htaccess file, to make non www request to www request.

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

Upvotes: 1

Related Questions