#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14

    Flash links loading pages from cache


    I have a page with a Flash movie on it. In the flash movie there are some links. One of the links points to a ColdFusion page that is producing some dynamic output. There is also a normal HTML link to that ColdFusion page on the same page the Flash movie is on. When I click the link in the Flash movie, it loads the page from the cache, but when I click the HTML link it makes a new request to the server, allowing my dynamic output to be generated correctly.

    I'm using IE 5 Win.

    What gives? Why is a link to the same URL loading the page from cache when clicked in the Flash movie, but correctly requesting it from the server when clicked in the HTML? How do I fix it?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    I think I see what's going on here -- Flash is basically (or exactly?) using the same model as JavaScript to trigger a location change in the browser, right?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Provo
    Posts
    36
    Rep Power
    12
    I'd want to see the Flash code.. but Flash treats a link the same as anything else....

    You do have the options in Flash to load in a different frame/window... bu tnothing like - 'load from cache'.

    If you have a link in Flash and you want to make sure that it is always loaded from the server, and never from the chache... you just append some random variable to the URL...

    Code:
    getURL("myscript.cfm?s="+ (new Date().getTime()));
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    But not everything "else" operates in the same way. For example, JavaScript code which assigns to window.location does not work the same way that clicking a link created with HTML markup does. I've had problems in the past with cached pages being loaded when they shouldn't be when activating a link created with JavaScript.

    I understand the concept of the example you gave, but that's a hack. Caching is an aspect of HTTP and is supposed to be governed by cache control headers. The way that the browser (in this case IE 5 Win) implements JavaScript, and apparently Flash (Flash is actually scripted with JavaScript, right?), with respect to assignment to window.location, or whatever is fundamentally happening, is flawed. Assigning to window.location should initiate the exact same behavior in the browser that clicking an HTML link does. But it doesn't. Hence my situation where clicking the Flash link spuriously loads the cached page and clicking the HTML link causes the browser to correctly evaluate the caching status of the page and request it from the server.

    In my case, the whole idea was to avoid having to edit the link in the Flash file.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Provo
    Posts
    36
    Rep Power
    12
    Yeah - it's a 'hack', but Flash has no other way of manually loading 'outside' of the cache.

    Sorry it didn't work for ya...

    Flash is actually not ~scripted~ with JavaScript.. but ActionScript is ECMA262 compliant (for the most part), so if you're familiar with JS then you'll be comfortable in AS... and vice versa.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Don't think I don't appreciate the suggestion, or that that is the SOP for Flash links.

    Yeah, yeah, my bad. I thought I read at some point that Flash's scripting language had been replaced by JavaScript -- maybe it was some other app, or I misinterpreted or misremembered what I read. I actually found a good article on the O'Reilly website that outlined the relationship between JavaScript and ActionScript.

    To make a long story short, I had a situation where I needed to make a link lead to a different page than it was currently. The link was included in HTML as well as a Flash movie throughout the website. My goal was to effectively change the link without editing all of the pages in the site (I didn't create the site, so it wasn't equipped with my Unique Data Management system) or changing the Flash file (I have done absolutely nothing in Flash). It would have worked except that, as I explained, the Flash link loaded a cached page instead of triggering processing of my ColdFusion script on the server.

    Thanks for the info.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Provo
    Posts
    36
    Rep Power
    12
    Ehh... you do what you can.

    I never thought you didn't appreciate the 'hack'.. I was agreeing with you - it's a hack. I wish MM would have given more freedom over things like that... but that'd probably make the player download bigger... and that's a no-no...

    Yeah - JS and AS are both ECMA262 based... and for the most part compliant.

IMN logo majestic logo threadwatch logo seochat tools logo