Integrate OLARK into Livecode App
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Integrate OLARK into Livecode App
Hi,
I am trying to integrate OLARKs online chat service with a desktop, android, and iPhone/iPAD compatible method. I was hoping I could just feed HTML with the JavaScript code straight into the URL argument with out having to load from a file, but I can not find any code samples or documentation on how to do this.
I also thought about just saving a local file named "htmlheader.html" and appending the javascript calls onload so I could use the method with other webservices that are similar.
Can anyone provide a newcomer the best way to accomplish this? maybe using OLARK as an example.
It would be appreciated
Regards,
Shane C.
I am trying to integrate OLARKs online chat service with a desktop, android, and iPhone/iPAD compatible method. I was hoping I could just feed HTML with the JavaScript code straight into the URL argument with out having to load from a file, but I can not find any code samples or documentation on how to do this.
I also thought about just saving a local file named "htmlheader.html" and appending the javascript calls onload so I could use the method with other webservices that are similar.
Can anyone provide a newcomer the best way to accomplish this? maybe using OLARK as an example.
It would be appreciated
Regards,
Shane C.
Re: Integrate OLARK into Livecode App
Ho Shane,
You can't send one line of JavaScript hoping that it will be executed. JavaScript must execute in a web browser. Your best bet is the RevBrowser external. Search the LiveCode dictionary for "brows" (without quotes).
Is there a particular reason why you want to use OLARK? If you want to build a chat feature into your standalone app, you might want to check out ChatRev.
Kind regards,
Mark
You can't send one line of JavaScript hoping that it will be executed. JavaScript must execute in a web browser. Your best bet is the RevBrowser external. Search the LiveCode dictionary for "brows" (without quotes).
Is there a particular reason why you want to use OLARK? If you want to build a chat feature into your standalone app, you might want to check out ChatRev.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Integrate OLARK into Livecode App
Hi Mark,
Thanks for the suggestion. I am not really looking to develop a chat application and server back-end when It may be possible to use something else that is bit more polished in the short term.
I have looked at the Browser Sampler stack and the provided examples. Each example loads from a URL or local File. I did not want to have to create a file outside of the application to send to revBrowser for loading. I guess in the end revBrowser is just calling OS browser specific objects and wrapping them or hooking into them, so they can not control the way the browser object for that operating system wants the info piped to it. I am just speculating here.
I just wanted to see if there was anything out there that made more creative use of the browser options and allowed the browser instance created by revBrowser to read output straight from a variable instead of having to write it out to file first and then have the browser object read it from the file.
Best Regards,
Shane
Thanks for the suggestion. I am not really looking to develop a chat application and server back-end when It may be possible to use something else that is bit more polished in the short term.
I have looked at the Browser Sampler stack and the provided examples. Each example loads from a URL or local File. I did not want to have to create a file outside of the application to send to revBrowser for loading. I guess in the end revBrowser is just calling OS browser specific objects and wrapping them or hooking into them, so they can not control the way the browser object for that operating system wants the info piped to it. I am just speculating here.
I just wanted to see if there was anything out there that made more creative use of the browser options and allowed the browser instance created by revBrowser to read output straight from a variable instead of having to write it out to file first and then have the browser object read it from the file.
Best Regards,
Shane
Re: Integrate OLARK into Livecode App
Hi Shane,
You can load URL's and HTML in the revBrowser control.
Have a look at the LiveCode dictionary to see all possibilities.
Edit: earlier, I wrote "html" and I have changed this to "htmltext".
Kind regards,
Mark
You can load URL's and HTML in the revBrowser control.
Code: Select all
revBrowserSet gBrowserID,"htmltext",the cHtmlFile25 of this stack
revBrowserSet gBrowserID,"url","http://ww.domain.xyz"
Edit: earlier, I wrote "html" and I have changed this to "htmltext".
Kind regards,
Mark
Last edited by Mark on Wed Jan 29, 2014 9:29 pm, edited 1 time in total.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Integrate OLARK into Livecode App
Thank you Mark =)
some more questions..
In the first line of code you reference "the cHtmlFile25 of this stack"
How do I get the file into the stack?
Do I import the file to some internal stack file system, like when you import images?
or do I need to generate the file and provide the path to the file?
Regards,
Shane
some more questions..
In the first line of code you reference "the cHtmlFile25 of this stack"
How do I get the file into the stack?
Do I import the file to some internal stack file system, like when you import images?
or do I need to generate the file and provide the path to the file?
Regards,
Shane
Last edited by escarroll on Wed Jan 29, 2014 9:38 pm, edited 2 times in total.
Re: Integrate OLARK into Livecode App
Hi Shane,
You can store an html file in a custom property with:
You can also use fields, buttons or any other control or a card instead of a stack.
You're right, I made a mistake writing "html", it should have been "htmltext". I'll change my previous post now.
Kind regards,
Mark
You can store an html file in a custom property with:
Code: Select all
set the cSomeHtmlFile of this stack to url "binfile:/path/to/some file.html"
You're right, I made a mistake writing "html", it should have been "htmltext". I'll change my previous post now.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Integrate OLARK into Livecode App
so this code stores the file in binary format as "cSomeHtmlFile" with in the stack?
Re: Integrate OLARK into Livecode App
Hi,
It stores the file "/path/to/some file.html" in the custom property cSomeHtmlFile of the current stack without converting the native line endings (crlf on Windows, lf on Unix system) into linefeeds.
Kind regards,
Mark
It stores the file "/path/to/some file.html" in the custom property cSomeHtmlFile of the current stack without converting the native line endings (crlf on Windows, lf on Unix system) into linefeeds.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Integrate OLARK into Livecode App
Well thanks for the input.
So far none of the methods provided have worked for me. I CAN load the file locally in Chrome and from a web server without issue. I can NOT load the file locally in IE or through the revBrowser call in Livecode.
I am using IE version 11 and newer versions of IE are very strict with loading local file content with scripts. I tried adding the "Mark-of-the-Web" (MOTW) comment to bypass the issue and that did not work. Now I am trying to figure out a workaround how to address Enhanced Protected Mode ( EPM ) with out compromising my browser security. I assume since revBrowser calls IE that any problems with IE are problems experienced with revBrowser too?
Regards,
Shane
So far none of the methods provided have worked for me. I CAN load the file locally in Chrome and from a web server without issue. I can NOT load the file locally in IE or through the revBrowser call in Livecode.
I am using IE version 11 and newer versions of IE are very strict with loading local file content with scripts. I tried adding the "Mark-of-the-Web" (MOTW) comment to bypass the issue and that did not work. Now I am trying to figure out a workaround how to address Enhanced Protected Mode ( EPM ) with out compromising my browser security. I assume since revBrowser calls IE that any problems with IE are problems experienced with revBrowser too?
Regards,
Shane
Re: Integrate OLARK into Livecode App
Hi Shane,
Problems experiences with IE are also to be expected in revBrowser and solution that work in IE may not work in revBrowser. For example, you can turn off error messages in IE but not in revBrowser.
Kind regards,
Mark
Problems experiences with IE are also to be expected in revBrowser and solution that work in IE may not work in revBrowser. For example, you can turn off error messages in IE but not in revBrowser.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Integrate OLARK into Livecode App
Yes I tried passing in a few other websites, some of the websites would throw errors and I would have to click continue to get the sites to come up. I was looking into how to trap the errors and handle them.
so problematic, but I guess this is typical of trying to make calls and use another application through a 3rd party API.
so problematic, but I guess this is typical of trying to make calls and use another application through a 3rd party API.
Re: Integrate OLARK into Livecode App
Yeah, using IE to run a Jscript chat that connects to a server that you not control. That's too many things that can go wrong for my comfort. That's probably why I made my own. Just to clarify, you can use chatrev without doing (almost) any coding. Just make sure that in the client you set the server IP/url to your own server stack (Or do it like the scripters scrapbook, and let everyone connect to my server (but ask me first)).
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Integrate OLARK into Livecode App
Great BvG, Thanks for the input