Deceptively Simple, but Hard to Find Solution

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
danallenvt
Forum Newbie
Posts: 5
Joined: Sun Oct 02, 2011 9:25 pm

Deceptively Simple, but Hard to Find Solution

Post by danallenvt »

Simple requirement: make slideshow with nothing else on the page, on a custom webpage, that works as close to possible like the slide show at this demo I setup:
http://go-redsox.net/002_MontpelierLife ... ex_dev.php

The php running this page pulls photo urls from mysql. The problem is with the javascript, not the php, but I thought people here might have some handy solutions to this deceptively simple problem.

The problem with this photo gallery is the javascript fails intermittently in some browsers. I feel like this is a relatively common, simple requirement, but I have not found a reliable solution.

Any assistance anyone can provide will be extremely much appreciated.

Best regards,
Dan Allen
Montpelier, Vermont
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: Deceptively Simple, but Hard to Find Solution

Post by egg82 »

By "some browsers" I assume you mean IE

"some browsers" and some browsers are not standards-compliant. Thus, you need to edit your code to accommodate them as well.
It's a pain, but it needs to be done if you want the "I know how to get on Facebook but that's it" users to be able to view your website.
Search the almighty Google and answers shall come.

More specifically, you'll need to search for the code that's giving you trouble and put "IE" at the end of it
danallenvt
Forum Newbie
Posts: 5
Joined: Sun Oct 02, 2011 9:25 pm

Re: Deceptively Simple, but Hard to Find Solution

Post by danallenvt »

egg82 wrote:By "some browsers" I assume you mean IE

"some browsers" and some browsers are not standards-compliant. Thus, you need to edit your code to accommodate them as well.
It's a pain, but it needs to be done if you want the "I know how to get on Facebook but that's it" users to be able to view your website.
Search the almighty Google and answers shall come.

More specifically, you'll need to search for the code that's giving you trouble and put "IE" at the end of it
Thanks for the reply. Problem has appeared in Chrome, Firefox, and IE at various times. It is crazy.

Isn't it kind of a scandal that something so simple is so difficult to accomplish?

Thanks again for the comments, much appreciated.

Dan
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Deceptively Simple, but Hard to Find Solution

Post by Weirdan »

What exactly you mean by 'the javascript fails intermittently in some browsers.'? How do you know it fails? Do you get any errors in js console?
danallenvt
Forum Newbie
Posts: 5
Joined: Sun Oct 02, 2011 9:25 pm

Re: Deceptively Simple, but Hard to Find Solution

Post by danallenvt »

Either jQuery or Galleria occasionally display javascript errors in IE, Firefox, and Chrome, with red banner background. The problem is well known among people trying to make the Galleria photo gallery add on to jQuery work. The error will appear, then sometimes disappear after refresh. The error even has been observed on the Galleria demo page.

I have not seen the error at the link I have up now as an example, but I expect sooner or later I will, even if I never change it.

http://go-redsox.net/002_MontpelierLife ... ex_dev.php

The intermittent occurrence of this problem is part of what makes it a hassle.

What I really want is a simple solution to a simple photo gallery requirement, not using Galleria, but something else that doesn't fail at times.

For more info about Galleria failing, you can google "galleria no theme found error"
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Deceptively Simple, but Hard to Find Solution

Post by Weirdan »

The code leading to this message suggests there's a timeout of 2 seconds:

Code: Select all

            // ....
            wait: function (a) {
                    var a = e.extend({
                        until: function () {
                            return !1
                        },
                        success: function () {},
                        error: function () {
                            g.raise("Could not complete wait function.")
                        },
                        timeout: 3E3
                    }, a),
                        b = f.timestamp(),
                        c, d, j = function () {
                            d = f.timestamp();
                            c = d - b;
                            if (a.until(c)) return a.success(), !1;
                            if (d >= b + a.timeout) return a.error(), !1;
                            l.setTimeout(j, 2)
                        };
                    l.setTimeout(j, 2)
                },
                // ............
      loadTheme: function(a) {
               // ....
               f.wait({
                   until: function () {
                        return c
                   },
                   error: function () {
                        g.raise("Theme at " + a + " could not load, check theme path.", !0)
                   },
                   success: function () {
                           // ....
                   },
                   timeout: 2E3
                })
               // ....
      }
If the theme is not loaded for any reason in two seconds (like if end-user has slow connection, their browser busy doing other tasks or the page the script runs on exhausted allowed number of connections to this host) you will get this error.

If you're going to use just one theme you could bundle the theme with the script itself (just add the code from the theme to the end of the script) and remove loadTheme() call from the page source entirely. This should get rid of that error permanently (and speed up page loading a bit as there will one less http request).
danallenvt
Forum Newbie
Posts: 5
Joined: Sun Oct 02, 2011 9:25 pm

Re: Deceptively Simple, but Hard to Find Solution

Post by danallenvt »

I am so in awe, I can't believe you traced through and found this. I will apply the change you suggested and let you know when it is done.
danallenvt
Forum Newbie
Posts: 5
Joined: Sun Oct 02, 2011 9:25 pm

Re: Deceptively Simple, but Hard to Find Solution

Post by danallenvt »

And thank you!
Post Reply