Getting nested iframes with Facebooker in iframe app - ruby-on-rails

Has anyone encountered nested iframes in their Rails/Facebooker application?
Basically, every time I click an action or link, the entire facebook page reloads inside my existing iframe, causing two (and more on each subsequent click) facebook borders to appear.
I've gone over the instructions three times and changed every setting imaginable, but the app still opens up in new facebook page inside the iframe. Any ideas anyone?
itonly appears when I use the
ensure_application_is_installed_by_facebook_user
filter, but if the user already has the application installed and I use the
ensure_authenticated_to_facebook
filter, it works fine...very strange (to me at least)

Turns out ensure_application_is_installed_by_facebook_user is deprecated because of a change in Facebook's API.
I plan to update the Facebooker documentation with this information soon.

I experienced the same thing with nested iframes, so I used "ensure_authenticated_to_facebook" instead. The only gotcha was that after the user installed the app, it would redirect them to my domain and not the facebook iframe page. After doing some tweaking in facebooker, I decided to hard code :canvas=>"true" in this method which is in lib/facebooker/rails/controller.rb line 189
def create_new_facebook_session_and_redirect!
session[:facebook_session] = new_facebook_session
next_url = after_facebook_login_url || default_after_facebook_login_url
#top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>params[:fb_sig_in_canvas]}) unless #installation_required
top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>"true"}) unless #installation_required
false
end
I wrote a tutorial on this fix in my blog - http://railsrant.com/2009/10/14/creating-a-facebook-iframe-app-using-ruby-on-rails-facebooker/

Related

Why is my RSpec + Capybara test failing to render view?

I use wicked (1.3.1) (not sure if relevant) for an onboarding flow on my rails 5 app. On the last step of my onboarding process, there is an <a> link that navigates to a user#dashboard page.
This works totally fine in all browsers. For some reason that transition does not work in Capybara (rspec 3.7, rspec-rails 3.7.2, Capybara 2.14). The url changes in the automated browser to the desired route, but the page does not render any content, it retains the old view. Visually its as if someone typed in a url but did not press return, however, the controller method and view are getting touched when i debug them. They appear to return a rendering, but the value is not rendered in the browser
If i throw a sleep in my test after the <a> click, I can manually click on the url bar, press return (to navigate to the correct url) and the page will render then. But not on its own. Anyone experience this before?
I have tried changing the href to a different path to see if it is a problem with the target view/controller - it is not, happens to all of the paths I try. I have also tried different capybara drivers: :selenium, :chrome, :poltergeist. All same result!
Would love to provide more detail but i'm not sure what to show. Its a simple href and i'm not sure what could go wrong.
Cheers
EDIT:
turns out there was an error in the logs. Will update with a solution.
error:
Could not log "render_template.action_view" event. NoMethodError: undefined method `render_views?' for RSpec::ExampleGroups::LayoutsSplash::View:Class ["/Users/mitchellmeyer/.rvm/gems/ruby-2.3.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:732:in `method_missing'",
The error shown in the logs is a know rspec/rspec-rails 3.6 issue - upgrading will fix that. Beyond that, the fact it works when a URL is submitted manually to the browser but not when clicking on the link indicates the link is probably being interfered with by JS. Most likely that's Turbolinks which you can disable for a given link by adding a data-turbolinks=“false” attribute to the link. If that fixes the behavior (which you state it did) then it's probable you have a JS error in one of your files. Check the developer console in the browser for any errors shown and fix them.
Since you mention Poltergeist, as a driver you tried, in your question it's possible for there to be silent errors that cause JS to fail when using it since it doesn't support anything beyond ES 5.1 so it's not really that suitable for testing modern webapps any more and I would recommend sticking to headless chrome if you need headless testing.

Bootstrap 3 with Skrollr site getting cut off on ios?

I've been creating a portfolio website for a friend. In an attempt to make the site responsive and artsy, I chose to pull in twitter bootstrap and skrollr. I noticed that in safari in iOS that the site seems to be cut off at a certain point. Has anyone else ran into this issue before? I have provided a link below in case anyone notices anything obvious.
http://jennaparysek.com/
Thanks!
A lot of people (including myself) are having troubles when using skrollr on mobile devices. In order to use both "fixed" and "relative/absolute" position at the same time, you have to put all the divs that are not fixed inside a div called #skrollr-body
However, the real problem is that your skrollr is being confused when getting the height of your
skrollr-body. you can try to put forceHeight: false inside your skrollr.init()
if that doesn't work, it might because skrollr doesn't know where is the end of #skrollr-body, so just put an empty div after your #skrollr-body and give it a keyframe. It should works just fine now :)

DNN Alert not working on DNN 7

I am using the 07.02.01 DNN Version
If I'm logged in with 'Super User Account', it works well. But if I'm not logged in or logged in with others accounts, it don't work.
I try adding the following 3 lines of code at the start of the Page_Load method.
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.jQuery);
DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(DotNetNuke.Framework.JavaScriptLibraries.CommonJs.DnnPlugins);
DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
but DotNetNuke.Framework does not have a JavaScript library class and DotNetNuke.UI.Utilities does not have a ClientAPI class.
I added these 2 lines but still not working:
jQuery.RequestRegistration();
jQuery.RegisterScript(this.Page);
Be sure jQuery is loaded. When you logged in with a super user account jQuery is automatically loaded.
I had a very similar problem, and hopefully the solution I found will also help you.
My problem was, we have an in-house developed "Contact Us" button available on every page, which opens a popup with a Contact Us form, using dnnModal.show.
The problem stems from dnn.js not being loaded, which is needed for popups, and I think alerts, too.
Our solution was to add this to the Page_Load event:
ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);
Remember to add your using/Import statement to import the DotNetNuke.UI.Utilities namespace. You also have to add DotNetNuke.WebUtility as a project reference.

Pins on Pinterest link to 404 - yet link is valid

this is a really strange one.
I've set up a bunch of pins on Pinterest linking through to our services which all work fine. Then I decided to do the same on our blog articles (we use Wordpress), yet everytime I click the link (and I've done this on different computers) the link goes to a 404 page on our site. However the link is valid and if you right click the pin and open in new window it opens fine: pinterest.com/pin/105342078755648946
I have contacted Pinterest who are next to useless. I have also tried different browsers, different computers and different Pinterest accounts.
I can't see any weirdness in my htaccess files causing this so I'm a little stumped. Any suggestions?
I found this when I was searching for the same issue - so though it's an old question I thought I'd answer for anyone else who is searching!
My client was using a really old version of WordPress, when I upgraded to the latest version it fixed the issue. After a bit of digging it turns out you have to be on WordPress 1.5.2 and beyond in order to fix it - as they applied the fix in that update.

Rails 3 Links are broken after activescaffold update

I just updated active scaffold on my rails app, and now all the links are broken on the site. If I hover over the link in firefox, I can see http://localhost:3000/correct_link; however, when I click the link, I end up at http://localhost:3000/current_link#__1_. When the link is loaded all styling/javascript is messed up. Furthermore, the number after the two underscores increases every time I click another link, but I can never navigate away from http://localhost:3000/current_link__NUM_.
Interestingly, if I type the url that I want into the browser, all is well. There don't seem to be any errors in my logs or in my server console.
I'm not sure how to go about debugging this
Aha! The error was caused by my removing active_scaffold, which introduced some weird behavior from custom javascript that had hooked into it. After active scaffold was removed, the javascript started hijacking the links. Shuffling the javascript around fixed the bug

Resources