On Which Page? Site Pagination from Scratch

On Which Page? Site Pagination from Scratch

16.10.2011

I’ve learned recently something I was hoping was over: different browser versions store or not the session cookies. The problem is that even the newest browsers can’t store session cookies or simply refuse them on default settings or with session cookies enabled.
I’ve learned recently something I was hoping was over: different browser versions store or not the session cookies. The problem is that even the newest browsers can’t store session cookies or simply refuse them on default settings or with session cookies enabled. Yesterday I rediscovered this problem with Opera, latest stable version, on a Windows XP SP3 PC, trying to fix some client’s pagination problems. My client was completely upset about that even if we assured him we can fix that ASAP. We managed to fix the problem in a matter of hours, in a week-end day. When we build a site, we try to test it on various machines with various hardware and software configurations, but, due to a large number of possible configurations, there still is a possibility to miss the client’s configuration. To eliminate that issue, from now on we emulate a machine similar to the client’s machine on which we test our solutions.

The Pagination Problem

The pagination on the client’s site was using a session cookie to store the current page number and then that number in the session cookie was supposed to be incremented by 10:
 1: '... somewhere in the code we assigned the "pag" cookie a value
 2: Session("pag") = 1
 3: '... some more code here ...
 4: currentPag = Session("pag")
 5: '... currentPag increments and Session("pag") gets updated
 6: currentPag += 10
 7: Session("pag") = currentPag
Ok, now that’s not the whole code, just some example from the top of my mind to illustrate the use of that session cookie. Apparently this session cookies was not supported by the good old Opera Browser on my client’s computer. The first fix that came to my mind was… use a cookie. That didn’t work either!

That’s Why They Use URL Params

So that’s why they use URL parameters, right? The problem was finally fixed as soon as we implemented the page parameters. Of course we had to add some more code and make some small changes to the master page to accept that params and work with them as it should, but we managed to use the old code (read “functions and events”) and everything is working now.

The Lesson Learned

If you want to do pagination from scratch be aware that browsers don’t like session cookies and they treat session cookies in different ways. Better use URL parameters then cookies. The only thing cookies are good when doing pagination is to keep you full while developing using URL parameters. But, if you don’t like the way URLs look after a long number of parameters, group them, split them inside your code and use URL rewrite, resulting in a beautiful user/search engine friendly URL. Cheers,

Promote your business or products in our podcasts

We produce two podcasts: Burzcast and micON. Promote your business or products in our text or video content as well. Slots are limited to one advertiser per week!

Articole Burzcast

Postări din arhivă

Revolutionizing Industry: How AI is Transforming the Industrial Internet of Things

The Industrial Internet of Things (IIoT) revolutionizes how companies operate, allowing them to optimize processes, improve efficiency, and reduce costs. One of the key technologies driving this transformation is Artificial Intelligence (AI).

Search Engine Optimization, Search Engine Marketing, and Copywriting Services are Dead. Get Over It!

SEO and SEM, as well as copywriting as we know it, are becoming less effective and are likely to become obsolete shortly.

#BlackLivesMetter

I am sad and it is a shame to see that, the country that prides itself on being the land of all possibilities and a fair country has come down to this.

A New Chapter for Burzcast

The transition to the new brand is almost done. As we are closing the doors to an old chapter in our business, we are opening them to a new one.

Why You Should Never Start a Podcast

The other day I had an interesting conversation with an old friend who was quite keen to tell me that I'm spending my money and time in the wrong way by doing a weekly podcast.

The New Burzcast Website

We have decided to build this brand in a way in which it can prove beneficial for the whole company.