Alpha Video Training
Page 1 of 2 12 LastLast
Results 1 to 30 of 42

Thread: Javascript caching

  1. #1
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Javascript caching

    I'm wondering about something I observe, but don't know enough or what I might do about it.

    First, an observation:

    If a user navigates to Page A for the first time during a session, it takes, say, 4 seconds to load the page. User submits record, navigates to previous page (a menu of sorts), then back to Page A again. This time and all subsequent times, it takes just 3 seconds to load the page.

    With this observation (roughly described) in hand, let's move to a different page/component and the current problem:

    User pokes button that loads a 30-row updateable grid in an AJAX window. Last 5 rows of the grid don't behave well when javascript methods and functions are called in those rows. Close the AJAX window, call it again with another 30 rows (different records mind you) and the last 5 rows behave well with javascript actions in the rows. This part that I'm describing here only occurs on the iPad, occurs a little unpredictably, but more often than not, and is not an issue on wired machines. Yes, iPad connectivity is terrific -- rule that out please.

    So, with this latest problem that I cannot seem to resolve, and these observations, I'm wondering if there's some kind of javascript caching going on with our pages and/or AJAX windows. And, if there is, is there a way I can "push" the javascript out there before or during the first load of the page/component to help alleviate some of this behavior?

    I don't know if this sounds "out there" or not but this "last 5 rows" problem just doesn't seem to have a solution so I'm stretching a little further than usual to find some way to manage it.
    -Steve


  2. #2
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    It sounds like it might be ios6 on the iPad and its nasty habit of caching POSTs. The short answer for the fix is to add a time stamp to the callback. That way the iPad sees the request as a new request and doesn't use what's in the cache. As far as I know only iOs6 is doing this. Everyone else follows the old rule that says that POSTs don't get cached. I ran into this shortly after iOs6 was released and had to add the timestamps to my ajax callbacks in my calendar app to get it to work correctly on the iPad. Don't you just love this stuff!
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  3. #3
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Thanks Jim. But I don't know how to do this.

    My description was that the last 5 rows don't respond well. What that means, for instance, is that a dropdown to select a value appears to work, but does not record the value in the table. So, when the grid is submitted (for the first time) any values from that dropdown disappear. A second value that doesn't record is a simple type-in text box. The submitted record is simply blank for those fields. But, rows higher up all have their dropdown and text-box values recorded in the table.
    -Steve


  4. #4
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    OK. I was going on the javascript caching comments. Do you get the same results with Chrome on the iPad? If so you can rule out the POST caching theory as Chrome behaves "normally".
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  5. #5
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Thanks Jim. I don't have the problems on my iPad for whatever reason, but many users do, and I can't ask them to install Chrome and try that.
    -Steve


  6. #6
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,

    Have you defined those JS functions in the component itself or are you using a linked js file? Try & see if any difference.

    Or try to see what happens if you link in the JS in the A5w page like this (in the HEAD section) :

    <script type="text/javascript" src="Javascript/yourjavascript.js"></script>

    Frank
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  7. #7
    Member
    Real Name
    Michael Darby
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    52

    Default Re: Javascript caching

    Hi Steve
    Did you find a solution to this? We are having similar problems on iOS6 and have had to revert to Google Chrome temporarily.

  8. #8
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Frank - with the exception of one line of javascript (recently added to try to help this situation), everything is as plain-Alpha as I can get it.

    Michael - no, don't have a solution. Odd thing is a few of us using iPad have no problem, but most can reproduce it pretty regularly. Still investigating and cannot ask my users around the world to switch to Chrome on their iPads - just can't do that. Plus, I shouldn't have to.

    Summary of Symptoms:

    In a grid with 25 records, and a checkbox row column, users are having a hard time getting any of the last 5 rows to check.

    I have conditional formatting to indicate that a row is checked -- that conditional formatting does not properly display even when a checkbox in the last five rows is checked.

    Each row has two fields for data -- one is a dropdown, the other a type-in textbox. If the row formatting doesn't display properly, users can correctly predict that the value of the dropdown box and the value of the type-in textbox will not be committed to the table on Submit.

    Currently using a pre-release build of a few weeks ago, and expect to move to the current pre-release build this Friday evening.
    -Steve


  9. #9
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,

    Don't know what you mean by plain-Alpha ? You mean the JS is in your component ? Cutting it there & pasting it in a .js file is plain-Alpha too. From there I'd test 2 ways: refer to that .js file in your component as linked javascript OR load it in the a5w page that contains your component by using script tags: <script type="text/javascript" src="Javascript/yourjavascript.js"></script>

    Takes only a few minutes to do and you might discover a different behavior especially with solution #2 as the browser directly deals with that script tag.
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  10. #10
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Frank - I don't think this is a/the problem.

    The grid has these columns:
    Checkbox (from the grid properties (has checkbox column)
    Animal Name (label)
    Trainer (dropdown)
    Food_Amt (text box)
    Button1
    Button2

    My point is that the user has a heckuva time getting the checkbox to check. This has been the case for weeks now.

    A few days ago, in an attempt to alleviate the problem, I added this to the Animal Name onClick event:

    $('{Grid.ComponentName}.V.R{Grid.RowNumber}.__ROWCHECKBOX').click();

    It's made no difference.
    -Steve


  11. #11
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,

    I was referring to your original post:

    >>And, if there is, is there a way I can "push" the javascript out there before or during the first load of the page/component to help alleviate some of this behavior?

    Unless you try to load the js already in the A5W page with script tags we'll never know...
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  12. #12
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    I guess I'm missing your point here Frank.

    The grid is contained in a dialog2. The dialog2 is launched as an AJAX window from a button. Exactly what are you suggesting I insert as code, and where?
    -Steve


  13. #13
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,
    You stated that you had "javascript methods and functions" that are called in the rows? I presume you mean JS functions you wrote? If yes then move those out of your component into a .js file and then in the a5w page containing your dialog component in the header section put this: (where yourjavascript.js is the file containing your js functions)

    <script type="text/javascript" src="Javascript/yourjavascript.js"></script>
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  14. #14
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    No, I'm referring to Alpha Five's javascript. I did not write any javascript except the one line shown in a previous message. This is as plain Alpha as I can get it with few embellishments from me.
    -Steve


  15. #15
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Ok the try & put this in the A5W page header:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <script type="text/javascript" src="javascript/a5.js"></script>

    The first 2 meta tags were recently introduced when you create a NEW a5W page
    The 3rd line loads the virtual Alpha5 Javascript library
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  16. #16
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    This I'll wait on - we went to great lengths to get everything working the way we want on the iPad. If the third piece (below) here doesn't work I might try this:
    Code:
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    This we already have:
    Code:
    <meta name="apple-mobile-web-app-capable" content="yes" />
    This I've inserted, but will have to wait for one of the other guys to test it tonight since I can' reproduce the problem
    Code:
    <script type="text/javascript" src="javascript/a5.js"></script>
    Thanks
    -Steve


  17. #17
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,

    Alos make sure to check out this video: http://www.ajaxvideotutorials.com/V1...checkboxes.swf
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  18. #18
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: Javascript caching

    Steve,

    One other thing that comes to mind is that with the move to mobile you don't want to work with grids anymore but rather with the dialog (UX) component
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  19. #19
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Well, OERCA is well underway and in production, so I can't move anything to V12 quite yet. Got another large project near approval (I think) that will be done all in V12 -- should be a lot of fun.

    Back later, asap when we've had a chance to test the tags you've suggested.
    -Steve


  20. #20
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    Michael - no, don't have a solution. Odd thing is a few of us using iPad have no problem, but most can reproduce it pretty regularly. Still investigating and cannot ask my users around the world to switch to Chrome on their iPads - just can't do that. Plus, I shouldn't have to.
    Steve, are you using iOs6 on your iPad? I didn't have a problem either until I upgraded.
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  21. #21
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Jim, I see that my iPad is at 5.1, and I'm not having the problem. I know one other person with an iPad One has not had the problem. I'm checking with others to see what they're using. Waiting to find that out before advancing mine to see if it changes the behavior I experience.

    If that's the case, do you have any suggested fix? As I've tried to describe below, the problems aren't with big fancy homegrown AJAX callbacks I'm creating, but with Alpha's built-in functionality. Checking a checkbox in the checkbox column, then recording data from two fields at Submit time.
    -Steve


  22. #22
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    Since you're running 5.1 without the problem you may find that 6 is the culprit. If so, the solution is to convince Safari that the requests are new, so it completes the call back to the server instead of serving up old data from the cache. I use a time stamp as in: "var _timestamp = new Date().getTime();", and add it to the callback parameters. Doing this with A5 grids and stuff will probably require an update from Alpha.
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  23. #23
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Yup, just finished my upgrade to iOS6, and now have the problem on my very own iPad.

    I wonder how to submit this to Alpha for any adjustment? Alternatively, what else might we try?
    -Steve


  24. #24
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,643

    Default Re: Javascript caching

    iOS7?
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  25. #25
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: Javascript caching

    Quote Originally Posted by Steve Workings View Post
    Yup, just finished my upgrade to iOS6, and now have the problem on my very own iPad.

    I wonder how to submit this to Alpha for any adjustment? Alternatively, what else might we try?
    Destroy Apple's headquarters with a 50 ft. tall Android™ and give everyone at FoXconn free Jelly Bean™ until they get sick and can't work?

    Now back to your regularly scheduled thread........

  26. #26
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    I wonder how to submit this to Alpha for any adjustment? Alternatively, what else might we try?
    You could try something like this in the beforeAjaxCallback client side event of the grid.

    Code:
    var __timestamp = new Date().getTime();
    {Grid.object}.setStateInfo({timestamp: __timestamp});
    This will add a time stamp to the __si2 parameter that is passed into each and every ajax callback.
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  27. #27
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    Quote Originally Posted by Steve Workings View Post
    The grid is contained in a dialog2. The dialog2 is launched as an AJAX window from a button. Exactly what are you suggesting I insert as code, and where?
    In this case do you have the "Use cahed UX Component" in the Target UX definition checkbox unchecked.
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  28. #28
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,629

    Default Re: Javascript caching

    Using version 11 here Jim, so no UX cache property.

    I'll try the timestamp idea on Saturday morning. Got a bunch of guys in Singapore using the app for a while and don't want to make a mistake and trouble them. Yes, they still use this piece if they can - if they don't need the bottom 5 rows. It's a valuable tool that I need to completely work, not just partially work.
    -Steve


  29. #29
    Member
    Real Name
    Jim Coltz
    Join Date
    Oct 2005
    Location
    Western Pennsylvania
    Posts
    600

    Default Re: Javascript caching

    Sorry about the reference to the V12 stuff. I'm always on the latest and greatest, trying to stay ahead of the game.
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    A5CustomSolutions.com
    jimcoltz@a5customsolutions.com

  30. #30
    Member
    Real Name
    Terry Futrell
    Join Date
    Aug 2008
    Location
    Tennessee
    Posts
    127

    Default Re: Javascript caching

    I'm having a problem accessing a system that has been in production for three years with Safari 6.x. I wonder if the problem is Safari rather than iOS6. In my situation, a grid is displayed with the primary key field serving as a link to the detail view for the record. With Safari 6.x, the link does not work for about 18 seconds after the grid is loaded. After that, it works every time. It previously worked correctly with Safari 5.x on a MAC. Using Safari 5.x on a PC, the link also works properly every time with no delay. It also works with IE. It appears to me that Apple has some real issues with Safari 6.x.

    Terry

Similar Threads

  1. Annoying Image Caching Problem with Alpha Web Server
    By shood38 in forum Application Server Version 11 - Web/Browser Applications
    Replies: 5
    Last Post: 03-27-2012, 04:18 PM
  2. E-Mail button on web app caching the first result
    By cavj1 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 03-14-2012, 05:56 PM
  3. Preventing AEX Caching (Tips)
    By aburningflame in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 05-26-2011, 01:55 PM
  4. CSS caching problem
    By Sparticuz in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 12-14-2009, 08:34 PM
  5. Caching or speeding up SQL
    By Atta in forum Application Server Version 9 - Web/Browser Applications
    Replies: 4
    Last Post: 02-18-2009, 02:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •