Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: Iframe redirect issues
Status | Resolved |
Add-on / Version | Publisher 2.10.6 |
Severity | |
EE Version | 4.3.7 |
Hop Studios
Feb 04, 2019Hello Brian,
I observed 2 anomalies while checking on the staging site.
1. When there is a scripts included with plain url (i.e. https://staging.lucistrust.org/includes/button_to_top_scripts) without any language prefix, chrome takes it to the script page when a switch_language_url is clicked
2. When I put an iframe without the language prefix but view it in different language, I get redirect too many times error on chrome and page redirection on safari
The first one is not a big deal because I can wrap all JS in minimee and the path redirection doesn’t happen. But the second one is kind of troublesome.
I have Show content fallback (FE) turned on and Persistent Entries turned on.
Testing page:
https://staging.lucistrust.org/ru/broadcast/testing
https://staging.lucistrust.org/admin.php?/cp/design/template/edit/608
BoldMinded (Brian)
A page like https://staging.lucistrust.org/includes/button_to_top_scripts (which I assume is loaded through an EE template?) looks like a normal http/page request to everything, including Publisher, so it doesn’t know that it is supposed to be a JS request and not perform any redirects. I’d suggest either use the hidden template prefix (. or _) or don’t serve JS files through EE templates (I’d recommend this approach).
As for the iframe issue, have you tried it without embedding the iframe code in a wysiwyg field? It’s probably struggling to find out what language to set it to.
BoldMinded (Brian)
Try changing the iframe source to src=”{site_url}/broadcast/simple_player”
Hop Studios
I moved the html out of the WYSWIG and pasted it directly in the template.
It loads now but it now redirects you to the iframe src. https://staging.lucistrust.org/broadcast/testing
However, if you type in the url specifically it works. https://staging.lucistrust.org/ru/broadcast/testing
Hop Studios
I don’t know if it’s useful information but on EE2 with version 1.7.5 the embed just works.
BoldMinded (Brian)
I would find a way to get the prefix in there the first time the iframe source is loaded. There isn’t a reliable, and more importantly a non-specific to your site way, for me to add code to Publisher to determine if the current request is inside an iframe.
Hop Studios
I tried your suggestions and they didn’t work when the switch language action is triggered. I dug deeper and found that the iframe url is getting recorded in the EE Tracker and being added to the segments to build to the url [Service/Url/Url.php @ line 380]. So when the switch language url is clicked, it goes to the iframe.
I’m assuming this happens to all sites with iframe. Can you provide any directions about how I can resolve this?
BoldMinded (Brian)
Did you try setting the src to src=”{site_url}/broadcast/simple_player”? Your last couple of comments weren’t very clear on if you did that part specifically.
Hop Studios
Yes I did.
So what happened was that when you go to https://staging.lucistrust.org/broadcast/testing which has the iframe src=”{site_url}/broadcast/simple_player”, clicking any one of the Switch Language Urls will take you to the src url like https://staging.lucistrust.org/el/broadcast/simple_player
This is because the set_language function calls the session service’s changeLanguage function which calls the url service’s addPrefixToUrl function. When the segment is built with getCurrentSegments, the iframe src is included.
Hop Studios
Hello Brian,
I’ve tested on a fresh install and confirm that this is happening on sites that have the following settings: Enable URL translations off Add URL Prefix on Add URL prefix to the homepage on Hide the prefix for default language on
Create a template includes/iframe Create a template testing/iframe and add the publisher switch urls with <iframe src=”/includes/iframe”></iframe> Go to site.com/testing/iframe Click a switch language url link and see how it takes you to site.com/includes/iframe rather than site.com/fr/testing/iframe
Here are the modifications that I made to make the site not go to the iframe url but rather stay on the actual page. Please review it if you will and let me know if the changes will collide with anything or cause anything crazy. Thanks! in Service/Session.php @ line 674
in Service/Url/Url.php @ line 379
@ line 793
@ line 823
in Service/Parser.php Add function
in ext.publisher.php @ line 1303
BoldMinded (Brian)
Thanks for sending this code. I feel like this is a pretty heavy handed and specific approach though. I’m going to have to think about this for a bit to see if it’s something I want to add to the core codebase.
In the meantime I would suggest documenting your changes in your project so you can re-apply the patch if you upgrade Publisher in the future.
BoldMinded (Brian)
Comment has been marked private.
Hop Studios
Comment has been marked private.
BoldMinded (Brian)
Thanks, I added that change to my repo.
BoldMinded (Brian)
So, this is causing an issue with YT’s autoplay feature when embedding, so I’m making it so that you have to set a hidden config value before it will add ?publisher_iframe=true to the iframe source, thus preventing the redirects. In 2.11.0 and going forward, you will need to add this to your config.php file: