iframe redirecting

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

tiroled
Posts: 2
Joined: Thu Mar 05, 2015 7:35 pm

iframe redirecting

Post by tiroled »

I am using my own CMS and with

Code: Select all

<iframe src="server.test/faq/"></iframe>
the page redirects to the index page of phpMyFAQ automatically.

How can I disable the automatic redirecting of phpMyFAQ in iframes?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi,

you have to remove the following code:

- https://github.com/thorsten/phpMyFAQ/bl ... ex.tpl#L40
- https://github.com/thorsten/phpMyFAQ/bl ... .js#L36-40

You have to rebuild the JS code again with grunt.

If you use the .htaccess file, please remove this line as well:

- https://github.com/thorsten/phpMyFAQ/bl ... access#L20

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
tiroled
Posts: 2
Joined: Thu Mar 05, 2015 7:35 pm

Re: iframe redirecting

Post by tiroled »

Awesome. It works. Thank you, Thorsten!!
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi,

the iFrame redirecting is a security feature. It was introduced with phpMyFAQ 2.8.18.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

Using a new developers install and get the following error with no code modifications. Followed this exactly:

$ git clone git://github.com/thorsten/phpMyFAQ.git
$ cd phpMyFAQ
$ git checkout 2.8
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
$ npm install
$ grunt

Produces this error:

Running "less:development" (less) task
>> FileError: '../../../../vendor/fontawesome/build/assets/font-awesome/less/font-awesome.less' wasn't found in phpmyfaq/admin/assets/less/style.less on line 25, column 1:
>> 24 //
>> 25 @import "../../../../vendor/fontawesome/build/assets/font-awesome/less/font-awesome.less";
>> 26 @FontAwesomePath: "../font";
Warning: Error compiling LESS. Use --force to continue.

Am using the package version of phpMyFAQ but need to remove this code for a iframe compatible version. Will not compile straight out of the box with grunt? What is an alternative approach to get a iframe compatible version? Or how is this fixed so I can compile my own?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi,

please pull the 2.8 branch again, I fixed that. Thanks for the hint!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

Fixed, thank you.
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

Successfully removed the listed source code and recompiled. This does not solve the problem of phpMyFAQ not redirecting to a full window from a iframe on login. Is there other changes required?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi,

what did you remove?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

From the above listed post:

- https://github.com/thorsten/phpMyFAQ/bl ... ex.tpl#L40
- https://github.com/thorsten/phpMyFAQ/bl ... .js#L36-40
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi,

that should be enough... are you sure you cleared your browser cache?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

Not sure what the issue is but followed recompiling successfully. I might not be installing it correctly as I used the pre-packaged version initially. All I get is blank page with no errors in the logs or to the screen. I have tried to make sure the configuration is identical to the pre-packaged version but I suspect there are other code changes that are not correct. I am thinking a reinstall of the developer version is required but I hope this is not the case.

Please point me to the installation documentation for a developer compiled version such that I can preserve the database and FAQ that I have already setup. If this resolved the blank page and the iframe redirect I think I will be able to use this otherwise I will need to find a different solution.

Cheers,

Mark
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: iframe redirecting

Post by Thorsten »

Hi Mark,

here it is: http://www.phpmyfaq.de/contribute

If you get a blank screen, you should enable the DEBUG mode in inc/Bootstrap.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
marklgreen
Posts: 7
Joined: Fri Oct 30, 2015 5:29 pm

Re: iframe redirecting

Post by marklgreen »

Unfortunately, I needed to install the developer version in order to get it to work properly which generated a new database. The existing packaged version database was brought up under a new URL and we copied and pasted the FAQs into the new developer version. The redirect issue is now resolved and the developer version is up-to-date with the existing FAQs. Thank you.
olealm
Posts: 4
Joined: Fri Jan 22, 2016 12:56 am

Re: iframe redirecting

Post by olealm »

I have the same problem, even if I remove the two lines instructed above (I do not use .htaccess), phpmyfaq still manages to escape the iFrame.
I downloaded the archive, transferred all files to the server manually and ran the install script. I made the change from above in the .js file locally and transferred the updated file to the server. Would I still have to recompile anything?

If not, is there anything else I can do to prevent phpmyfaq from escaping its iFrame?

I could sandbox the iFrame (making the website html5 only, I guess), but unfortunately that prevents other pages using the same iFrame from working correctly.

EDIT, working now:
Had to remove the same code in this .js too:
https://github.com/thorsten/phpMyFAQ/bl ... q.js#L1716
(And obviously in the corresponding .min.js file)

Also, had to add an ?v=x for the below .js call. Since java script files are also cached by (at least my..) web hotel provider.
Here:
https://github.com/thorsten/phpMyFAQ/bl ... ex.tpl#L32
Last edited by olealm on Fri Jan 22, 2016 10:31 am, edited 3 times in total.
Post Reply