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

Charles Warwick charles at techstrategies.com.au
Fri Mar 16 18:01:23 EDT 2018


Just remember the browser widget in LiveCode uses CEF (Chromium Embedded Framework) on all platforms.

It doesn’t need to work on Safari or Firefox.

> On 17 Mar 2018, at 1:40 am, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> this solution has to work flawlessly in production on all 3 desktop
> platforms.
> 
> I'm giving a shot to modifying LibURL..... I wish I knew why the limit is
> in there to begin with, that would help to know if I am wasting my time or
> not.
> 
> Realistically if it was as easy as just hacking that code, someone would
> have done it already.
> 
> Its fun anyways....I have to solve this.......even if I speed it up just a
> little bit ......
> 
> Its not an emergency situation so its a fun problem to think about until
> its solved.
> 
> some good ideas from you guys.... thanks everyone
> 
> On Fri, Mar 16, 2018 at 11:31 AM, Mike Bonner via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> Yeah, thats what I was talking about, but I never tried it with safari i'm
>> afraid. Sounds like something funky with safari, though i'm not sure why my
>> method wouldn't work unless safari is smart enough now to recognize an
>> inline link and NOT treat it as a new URL to cache.
>> 
>> If this is only for your personal use, you can disable caching on safari as
>> described here: https://www.technipages.com/apple-safari-completely-
>> disable-cache
>> If you have safari 11, check here instead to disable cache:
>> https://stackoverflow.com/questions/46324675/how-do-
>> i-disable-cache-in-safari-11-0
>> 
>> If this is for an app being shipped though thats not a solution.  You said
>> firefox works fine, so i'm guessing you don't have some type of caching
>> proxy between you and the server.  Either way, from what I've been reading
>> just now, rather than using meta tags, you're more likely to get the
>> desired result if you set the headers directly.  One way to do this would
>> be with an .htaccess file.
>> https://stackoverflow.com/questions/11532636/how-to-
>> prevent-http-file-caching-in-apache-httpd-mamp
>> You'd need to add .lc to the filesmatch so that they're not cached.
>> 
>> Hopefully the correct module is installed. If it isn't, while I've never
>> done it, I believe you can set the headers to return using lc in your
>> server script (assuming you're using lc.) I know php can.  If you're using
>> something other than apache of course, ignore the above.
>> 
>> On Fri, Mar 16, 2018 at 8:53 AM, Rick Harrison via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> 
>>> Hi Mike,
>>> 
>>> I am finding that Safari is not honoring
>>> the meta tag to turn off caching.  I thought
>>> I would give your method a try.  I’m not
>>> sure I am doing it right though because
>>> that isn’t working either.
>>> 
>>> (Firefox does everything properly.)
>>> 
>>> I was thinking from your description that
>>> it would look something like:
>>> 
>>> http://www.yourwebsite.com/coolpage.lc#48432 <
>> http://www.yourwebsite.com/
>>> coolpage.lc#48432>
>>> 
>>> Is the above example of what you are discussing
>>> correct?  If not could you please post an example?
>>> 
>>> Thanks,
>>> 
>>> Rick
>>> 
>>>> On Mar 16, 2018, at 9:31 AM, Mike Bonner via use-livecode <
>>> use-livecode at lists.runrev.com> 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
>> _______________________________________________
>> 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