Not sure what to do.....can I run this by you guys?

Tom Glod tom at makeshyft.com
Mon Mar 19 04:54:13 CET 2018


Yup, realized that when I thought about and tried mikes suggestion

Yes using a ? works just the same as # but may be safer in some way..

I'm just completing demo stack for this .....works flawlessly.

Thanks to everyone who chimed in here to help me find solution...hopefully
i can make it easier on others to publish a demo stack.




On Sun, Mar 18, 2018 at 10:39 AM, Ben Rubinstein via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I think this depends on the base URL.  If it's with a simple URL, there's
> no reason why an appended '#' parameter should cause a browser to request
> it fresh; as Mike says, it indicates scrolling to an anchor in the page. So
> it's perfectly reasonable for a smart browser - or a caching layer on the
> server, or in a proxy somewhere between you and the server - to use a
> cached version of that page ignoring the '#' suffix.
>
> With a simple URL, the better choice is to use "?" to append a parameter
> (I usually use 'the milliseconds' to guarantee that it's unique). Neither
> the browser nor any caching layer on the chain between the user agent and
> the source system should recognise it as the same URL, so this should force
> a fresh load. You can just use e.g.
>         put "?" & the milliseconds after tURL
>
> or to be more explicit, name the parameter something e.g.
>         put "?nocache=" & the milliseconds after tURL
> or
>
>         put "?uniqueid=" & the milliseconds after tURL
>
> The only downside of using "?" is that if the URL may already includes
> parameters starting with "?" (which is what I mean by "not a simple URL"),
> you need to test for that and use "&" instead of "?" to indicate that this
> is an additional parameter; and if this is a dynamic request, which uses
> the 'query parameters' in the URL to decide what to return, you need to be
> sure that adding your parameter won't affect it!
>
>
> On 16/03/2018 13:31, Mike Bonner via use-livecode wrote:
>
>> Another way around the cache problem is to use the #2 trick at the end of
>> the url.  Send each request with a pound and different number at the end
>> of
>> the url and it'll be seen as a new request thus doing an end run around
>> the
>> cache.  Since it designates an inline anchor position on the page, it
>> should have zero affect on the way the url functions.  (unless things have
>> changed, the associated anchor doesn't need to exist on the page)
>>
>> Thanks for the neat trick Charles. :)
>>
>> On Fri, Mar 16, 2018 at 7:24 AM, Tom Glod via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>
>> Wow....I'm impressed....thats quite a hack Charles..I will study all this
>>> see how far I get.....
>>>
>>> Thank you gentlemen....you are Rockstars!!
>>>
>>> On Fri, Mar 16, 2018 at 7:13 AM, Lagi Pittas via use-livecode <
>>> use-livecode at lists.runrev.com> wrote:
>>>
>>> Maybe not 100% reliable but ....
>>>>
>>>> https://stackoverflow.com/questions/1341089/using-meta-
>>>> tags-to-turn-off-caching-in-all-browsers
>>>>
>>>> Regards Lagi
>>>>
>>>> On 16 March 2018 at 09:48, Charles Warwick via use-livecode
>>>> <use-livecode at lists.runrev.com> wrote:
>>>>
>>>>>   Hi Tom,
>>>>>
>>>>> If the site you are trying to contact has CORS enabled appropriately,
>>>>>
>>>> then you can do something like this...
>>>>
>>>>>
>>>>> With the LiveCode browser widget, you can call JavaScript functions
>>>>>
>>>> from
>>>
>>>> LC script and have the JavaScript functions call LC handlers in return.
>>>> JavaScript has the capability to perform asynchronous HTTP requests.
>>>>
>>>>>
>>>>> You can create a HTML page that you automatically load up in the
>>>>>
>>>> browser
>>>
>>>> widget that has a small JavaScript function which you can call from LC
>>>>
>>> with
>>>
>>>> ‘do in widget’.   All this function needs to do is issue an asynchronous
>>>> HTTP call to the URL passed to it as a parameter and when it receives
>>>> the
>>>> data, return it back to your LC script by calling a nominated LC handler
>>>> and passing the returned data as a parameter.
>>>>
>>>>>
>>>>> The HTML page would look something like this:
>>>>>
>>>>> <html>
>>>>> <head>
>>>>> <title>Javascript Async Test</title>
>>>>> <script type="text/javascript">
>>>>>
>>>>> function httpGetAsync(theUrl)
>>>>> {
>>>>>      var xmlHttp = new XMLHttpRequest();
>>>>>      xmlHttp.onreadystatechange = function() {
>>>>>          if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
>>>>>              liveCode.httpRequestComplete(theUrl,
>>>>>
>>>> xmlHttp.responseText);
>>>
>>>>      }
>>>>>      xmlHttp.open("GET", theUrl, true); // true for asynchronous
>>>>>      xmlHttp.send(null);
>>>>> }
>>>>> </script>
>>>>> </head>
>>>>> <body>
>>>>> </body>
>>>>> <html>
>>>>>
>>>>> You can either load that from a file into the browser widget’s URL or
>>>>>
>>>> set its htmlText property accordingly...
>>>>
>>>>>
>>>>> Then in LC, make sure you register the httpRequestComplete handler so
>>>>>
>>>> that the widget can call it:
>>>>
>>>>>
>>>>> set the javascriptHandlers of widget “browser” to “httpRequestComplete”
>>>>>
>>>>> After that, add a httpRequestComplete handler to the card script to
>>>>>
>>>> handle the returned data:
>>>>
>>>>>
>>>>> on httpRequestComplete pUrl, pData
>>>>>     — pUrl will be the URL requested
>>>>>     — pData will be the data returned from the URL requested
>>>>> end httpRequestComplete
>>>>>
>>>>> Lastly, make your async requests....
>>>>>
>>>>> do (“httpGetAsync(‘http://www.livecode.com’);” in widget “browser”
>>>>>
>>>>> Since the JavaScript in the browser widget is issuing the requests and
>>>>>
>>>> sending the data back to LC, it doesn’t need to display anything related
>>>>
>>> to
>>>
>>>> it in the browser widget itself - it can be a blank canvas.
>>>>
>>>>>
>>>>> Just be aware that the browser widget can cache URLs and there is no
>>>>>
>>>> easy way (that I know of?) in LC to clear the browser’s cache... so if
>>>>
>>> you
>>>
>>>> see very quick responses on a second or subsequent request to the same
>>>>
>>> URL,
>>>
>>>> it is likely pulling it all from the browser’s cache.
>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Charles
>>>>>
>>>>> On 16 Mar 2018, at 1:35 pm, Tom Glod via use-livecode <
>>>>>>>
>>>>>> use-livecode at lists.runrev.com> wrote:
>>>>
>>>>>
>>>>>>> Great hints there Mike .... thanks alot.  Luckily I'm desktop only
>>>>>>>
>>>>>> right
>>>>
>>>>> now.
>>>>>>>
>>>>>>> It shouldn't be too long before I sit down to make something that I
>>>>>>>
>>>>>> can
>>>
>>>> rely on and reuse in future projects.
>>>>>>>
>>>>>>> Might turn out I will have to hire someone to help which is cool too.
>>>>>>>
>>>>>>> It only has to be very simple..and does not need to match performance
>>>>>>>
>>>>>> of
>>>>
>>>>> Tsnet.
>>>>>>>
>>>>>>> Anything more than 1 would be a great start. LOL.
>>>>>>>
>>>>>>> I will look into the libURL library and then try to guess which way I
>>>>>>> should go my first attempt to hack this.
>>>>>>>
>>>>>>> I'll keep you guys posted on the progress..I think I need a name for
>>>>>>>
>>>>>> this
>>>>
>>>>> little project.
>>>>>>>
>>>>>>> Thanks you
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>
>>>> subscription preferences:
>>>>
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list