Page 1 of 2

BrowserControl with scriptable web console?

Posted: Thu Feb 20, 2014 8:02 pm
by EssoAir
Hello everyone,

I am developing an app for my school. It will allow students to easily see their online grades without having to use the crummy website. I do not have access to the server but I do have permission from the IT department to break SDP to achieve my goal. This means I need the ability to use client-side scripts to edit the HTML to my liking.

For example:

Inside the webpage there is div#test

I want the ability to extract div#test without using an iFrame or anything else.

I think the easiest way would be to .hide() everything OTHER then div#test but this would require access to the browser console on the client.

Can anyone help me out here?

Thanks!

Re: BrowserControl with scriptable Firebug?

Posted: Fri Feb 21, 2014 2:11 pm
by Klaus
Hi EssoAir (?),

1. welcome to the forum! :D
2. To be honest, I have no idea what you are trying to do!


Best

Klaus

Re: BrowserControl with scriptable Firebug?

Posted: Fri Feb 21, 2014 3:40 pm
by EssoAir
Hmmm was i unclear?

I need the ability to access the Web Console of the BrowserControl from my livecode scripts.

Can this be done?

Re: BrowserControl with scriptable Firebug?

Posted: Fri Feb 21, 2014 3:46 pm
by Klaus
EssoAir wrote:Hmmm was i unclear?
Hm, maybe I know too little about this stuff... :D
EssoAir wrote:I need the ability to access the Web Console of the BrowserControl from my livecode scripts.
Can this be done?
I'm afraid it can't.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 3:47 pm
by Klaus
But maybe you can get the source of the currently displayed html page,
modify it and set the browser to the modified html?

That can be done wiht the bowser object and Livecode.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 3:52 pm
by EssoAir
But that fhanges the host domain to local. I need the document.domain to stay the same as the host. The only way to do that AND edit the html is through the web console. I wrote most of my app in HTML 5 already but this was the wall I hit there. I figured switching to LC could allow me to do the last touches.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 3:58 pm
by Klaus
You can also write the modified html back to the server via FTP or a CGI on the server.
In any case you cannot acces the more advanced features of a "system"*** browser
like the "web console" or whatever.

*** The browsing functionality is provided by the underlying OS:
Mac -> Safari/Webkit
Windows -> IE

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:18 pm
by EssoAir
But as I said in the OP, i dont have access to the server.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:29 pm
by Klaus
But a "console" would also need to write the modified data back to the server, not?
As I said, I'm not an "internet guy" :)

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:43 pm
by EssoAir
Klaus wrote:But a "console" would also need to write the modified data back to the server, not?
As I said, I'm not an "internet guy" :)

If you have firefox on your computer, open the web console and type "alert('This is cool')" (without the double quotes) You just called the javascript function "alert" with the argument 'This is cool' The ability to call javascript methods is a client-side thing not a server thing. This has nothing to do with the server it is 100% client.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:48 pm
by Klaus
You can execute JavaScript in a LC browser object using -> revBrowserExecuteScript(...)

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:49 pm
by EssoAir
Klaus wrote:You can execute JavaScript in a LC browser object using -> revBrowserExecuteScript(...)
OH? Well then that should do exactly what i need. I'll do some testing tonight! Thank you good sir ;)

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:51 pm
by EssoAir
While I still have your attention, is it possible to scroll the BrowserControl to a specified position and then prevent the user from moving it around? That would make things a lot easier.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 4:59 pm
by Klaus
EssoAir wrote:While I still have your attention, is it possible to scroll the BrowserControl to a specified position
Yes, you can set the h and vscroll of an brtowser object!
Check -> revBrowserSet in the dictionary for settable properties for a browser.
EssoAir wrote:.. and then prevent the user from moving it around?
You can hide the scrollbars, but that's all.

Re: BrowserControl with scriptable web console?

Posted: Fri Feb 21, 2014 5:09 pm
by EssoAir
Klaus wrote:
EssoAir wrote:While I still have your attention, is it possible to scroll the BrowserControl to a specified position
Yes, you can set the h and vscroll of an brtowser object!
Check -> revBrowserSet in the dictionary for settable properties for a browser.
EssoAir wrote:.. and then prevent the user from moving it around?
You can hide the scrollbars, but that's all.
Thank you! When you first commented with "I have no idea what you're trying to do" I figured you would be of no help but I was definitely proven wrong.

Thank you again!

Esso