The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Session data not getting passed to custom lightbox in iOS Safari

jlivingstonjlivingston Member
in Help edited January 2013
Hi Guys,

I have a client who uses a custom light box for their cart. It works fine in every browser except for iOS Safari, where it appears that the session data is not getting passed successfully (works fine in Safari Desktop). All of the links have the foxycart class, and I'm using foxycart.js. Any clues why this might be happening?


  • fc_adamfc_adam FoxyCart Team

    Care to share a link? We'll take a look and see if anything jumps out at us.
  • Thanks Adam. If you add an item to the cart, then close it, then add another item, in iOS, you should see that it doesn't show the first item in the cart.
  • fc_adamfc_adam FoxyCart Team

    Testing that on my iPhone (iOS 6) it is maintaining the session just fine - if I add three different products to the cart I'm seeing three products in the cart.
  • That's bizarre. I'm running iOS 6 too. Can you clear your cache and try one more time?
  • fc_adamfc_adam FoxyCart Team
    Huh. So after clearing my browser cache, it's doing the same thing that you're seeing - only adding the last product to the cart. That is very bizarre.
  • Yeah, I don't know how you were getting those results. The only way I can get it to do maintain the session, is to disable the lightbox, make the links go directly to the cart (full page), then re-enable the light box. Once I do that, somehow the session gets connected, and I can add multiple products the lightbox. But if I clear my cache, it goes back to this strange single product cart, which I think I'm correctly assuming has something to do with a failure to bridge the session across multiple domains.
  • I inherited this site, by the way. :P
  • fc_adamfc_adam FoxyCart Team

    So my best guess is this does relate to the session not being tracked properly, either just on iOS or iOS isn't handling it as gracefully as other options.

    The way that the session is added to the links is through a jQuery delegate call - that adds it to the href on click of the link. I'm guessing the shadowbox is being called on the URL before that can happen.

    One solution I can think of would be to call Shadowbox via javascript like we do for Colorbox - do they have that option?
  • fc_adamfc_adam FoxyCart Team
    @jlivingston -

    Actually, the second option would be to add in the session data onto those links on page load, and see if that fixes the issue. That would at least tell you if that is the issue or not.
  • Hi Adam,

    That second options sounds hopeful. Would you mind providing some example code for that? Is it anything like what your asynchronous google analytics integration does, as in this line:

    jQuery.getJSON('https://' + storedomain + '/cart?' + fcc.session_get() + '&h:ga=' + escape(pageTracker._getLinkerUrl('', true)) + '&output=json&callback=?', function(data){});


  • fc_adamfc_adam FoxyCart Team

    This should do it for you - in a jQuery document ready call on your page -
    jQuery('a[href*="' + storedomain + '"]').each(function(){
    	var regex = new RegExp(FC.session_name+'=([A-Za-z0-9]*)');
    	if (!regex.test(jQuery(this).attr('href'))) {
    		jQuery(this).attr('href', jQuery(this).attr('href') + fcc.session_get());
  • Thanks a ton, Adam. It took a little more finagling, but that bit of code gave me the leg up I needed. The problem appears to be solved now.
  • fc_adamfc_adam FoxyCart Team
    @jlivingston - what exactly was the route cause?
  • Your solution of adding the session to links worked. However, after clearing the cache, the fcc.session was not available on document ready during the very first page load, only the subsequent. The fcc.session was there, just not directly after the document.ready event fired. My solution was to remove all shadowbox classes (their custom lightbox) from links, and call the shadowbox with javascript during the firing of The session was available then under all circumstances, so I just inserted it into the shadowbox call.
  • fc_adamfc_adam FoxyCart Team

    Did you try running it in the cart.ready event? That is only run after the session is loaded, details here:
  • Seems to be working perfectly with what I've done. Here's my code:
    jQuery(document).ready(function() {
             // skip the automatic setup again, we do this later manually
             skipSetup: true
      // Restart the process event collection object = new FC.client.event();
      // Define the new process event{
        var href = '';
        if (e.tagName == 'A') {
          href = e.href;
        } else if (e.tagName == 'FORM') {
          href = 'https://'+storedomain+'/cart?'+jQuery(e).serialize();
        if (href.match("cart=(checkout|updateinfo)") || href.match("redirect=")) {
          return true;
        } else if (href.match("cart=view")) {
          /* Add your own modal window display logic here. Make sure to include the following:
             URL to load in the modal: href
             Call the following if an onClosed callback is available:
          return false;
        } else {
          // open a welcome message as soon as the window loads
                 content:    href + fcc.session_get(),
                 player:     "iframe",
                 height:     330,
                 width:      675
          return false;

    It appears to work in all browsers. Is there any concerns with this approach?
  • fc_adamfc_adam FoxyCart Team

    For what it's worth - you probably don't need to add the session in that instance. If you view the source of the iframe in the cart, the session is actually included in their twice. Once by the delegate call I mentioned earlier, and again with your addition there. It shouldn't have any negative effects having it twice in the URL - but something to be aware of none-the-less.
  • i got session error while opening a game link using light box in Internet explore.

    Session Error:
    Unable to start a game.

    kindly guide me through this asap. i will be greatful to you.

    best regards.

    Aamir Shahzad
    Web Developer.
  • fc_adamfc_adam FoxyCart Team

    I think you might have hit the wrong forums here - these forums are for FoxyCart - which I'm not sure you're utilising from your query there - so we're probably not the best people to offer you support for the issue you're experiencing. Sorry!
  • Double check that LastPass is enabled in Safari.
    Make sure that Safari's autofill feature is turned off:
    Go to iOS Settings > Safari
    Under General, tap Passwords and Autofill
    Toggle Names and Passwords to 'Off'
    Try reprompting LastPass to autofill:
    Tap the Share Icon
    Tap the LastPass Extension
    If PIN or Touch ID is enabled, authenticate
    Select the credentials
    Make sure that the site has username and password fields.
    Try readding the site from mobile Safari:
    Tap the Share Icon
    Tap the LastPass Extension
    In the bottom right, tap 'Add new Login'
    Fill in the appropriate Data
    Select 'Save'
    Retry autofilling the site.
    Try using the copy buttons to fill in the data.
    Tap the Share Icon
    Tap the LastPass Extension
    If Pin or Touch ID is enabled, authenticate
    Tap and hold on the credentials until the copy buttons appear
    Paste the data into the appropriate fields
    If you still have trouble, please submit a support ticket below indicating the exact URL where autofill failed.

    Get the latest apps for free on Tutu helper iOS app store.
Sign In or Register to comment.