BrowserControl with scriptable web console?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

BrowserControl with scriptable web console?

Post by EssoAir » Thu Feb 20, 2014 8:02 pm

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!
Last edited by EssoAir on Fri Feb 21, 2014 3:42 pm, edited 1 time in total.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable Firebug?

Post by Klaus » Fri Feb 21, 2014 2:11 pm

Hi EssoAir (?),

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


Best

Klaus

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable Firebug?

Post by EssoAir » Fri Feb 21, 2014 3:40 pm

Hmmm was i unclear?

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

Can this be done?

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable Firebug?

Post by Klaus » Fri Feb 21, 2014 3:46 pm

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.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable web console?

Post by Klaus » Fri Feb 21, 2014 3:47 pm

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.

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 3:52 pm

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.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable web console?

Post by Klaus » Fri Feb 21, 2014 3:58 pm

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

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 4:18 pm

But as I said in the OP, i dont have access to the server.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable web console?

Post by Klaus » Fri Feb 21, 2014 4:29 pm

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" :)

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 4:43 pm

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.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable web console?

Post by Klaus » Fri Feb 21, 2014 4:48 pm

You can execute JavaScript in a LC browser object using -> revBrowserExecuteScript(...)

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 4:49 pm

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 ;)

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 4:51 pm

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.

Klaus
Posts: 14212
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: BrowserControl with scriptable web console?

Post by Klaus » Fri Feb 21, 2014 4:59 pm

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.

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: BrowserControl with scriptable web console?

Post by EssoAir » Fri Feb 21, 2014 5:09 pm

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

Post Reply