Jump to content

iFrame + Joomla - Small redirect script not working [HELP]


(iTD)

Recommended Posts

I am running a Joomla 2.5 website plus WHMCS 5. I have seen many questions out here regarding what I am about to ask, but this is a slightly different issue that has not been addressed.

 

Using the WHMCS "classic" template, I am making alterations to "header.tpl" by placing a javascript in the <head> section to check if WHMCS is in an iFrame. If not, then redirect users to the Joomla page that contains the iFrame with WHMCS inside of it. Simple enough.

 

However, it does not appear that the script is executing. Is there a setting in WHMCS to allow javascript to run from a template? I tested this script in a plain HTML file and it worked perfectly.

 

Here's the script that I placed in the <head> of header.tpl:

 

<script type="text/javascript">
if (window == top) 
{
   var querystring = top.location.search.substring(1); // gets everything after the ? in the URL
   var newtop = "http://mysite.com/joomla-page"; // the site is not live and I don't want to post the url here.
   location.replace( newtop + "&" + querystring );
}
</script>

 

Any help would be appreciated.

 

 

PLEASE - if you don't agree with the use of iFrames then please DO NOT comment on this post. I need help, not design opinions :)...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated