Jump to content
UBot Underground

How Can I Lock The Default Browser?


Recommended Posts

hey guys,

 

Do you know of a way in ubot to lock the main browser window temporarily so the user can watch automation occurring but cannot click anything in the browser window? I know I can hide stuff, but for this situation, I'd like to display things happening but I don't want to user to mess things up.

 

A bonus would be an alert window that pops up telling the user that they cannot make changes and to be patient.

 

Frank

Link to post
Share on other sites

**sorry made a msitake :) edited**

this should do it,but its a bit dirty,three functions,

NavigateLockPage use this for navigating to new pages,or if clicking a link that leads to a new page,leave it blank under the click command,all this command does is inject jquery into the new page

lockPage 

unlock

lock and unlock,only tested for a minute on this web page,seems to work fine,

tried at first to only use ubot only and no JS but couldn't do it,

before you want ubot to take control of the browser use unlock,do task followed by lock

define NavigateLockPage(#myURL) {
    if($comparison(#myURL,">",$nothing)) {
        then {
            navigate(#myURL,"Wait")
        }
    }
    wait for browser event("DOM Ready","")
    wait for browser event("Page Loaded","")
    wait for browser event("Everything Loaded","")
    run javascript("var myScript = document.createElement(\"script\")
myScript.src = \"https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"
var clicked = false
var locked = true
document.body.appendChild(myScript)")
    wait(1.2)
}
define lockPage {
    run javascript("var clicked = false
$(\"body\").click(function(e)\{

if(clicked === false && locked === true)\{
   e.preventDefault();
  \}
 clicked = true
\})")
    wait(0.3)
    thread {
        loop while($comparison($eval("locked"),"=","True")) {
            wait(0.3)
            if($comparison($eval("clicked"),"=","True")) {
                then {
                    alert("Pay Attention!!")
                    run javascript("clicked = false
")
                }
            }
        }
    }
}
define unlock {
    run javascript("locked = false

")
    wait(0.3)
}
Link to post
Share on other sites

Deliter, thanks for the code! I've gotta be super careful because ubot still has to interact with the page while the user cannot. It may come down to hiding the page and providing a sudo page to give the user something to look at.  Jomark, the alert idea was something I was thinking of as well. But nothing is going to stop them to click ok and then interact with the window. More thought is needed, lol.

 

Frank

Link to post
Share on other sites

Deliter, thanks for the code! I've gotta be super careful because ubot still has to interact with the page while the user cannot. It may come down to hiding the page and providing a sudo page to give the user something to look at.  Jomark, the alert idea was something I was thinking of as well. But nothing is going to stop them to click ok and then interact with the window. More thought is needed, lol.

 

Frank

I dont see what is wrong with it,you have block and unblock so you can control when ubot takes control and when to lock it,also it is ubot not the browser that sends the alert box so it doesnt block the operation of the browser window in the mean time

Link to post
Share on other sites

Let me ask you Deliter, when the javascript locks the browser, can ubot still interact with it or would I tell ubot to unlock when it needs to do something and then re-lock it right away?

 

Frank

Link to post
Share on other sites

Let me ask you Deliter, when the javascript locks the browser, can ubot still interact with it or would I tell ubot to unlock when it needs to do something and then re-lock it right away?

 

Frank

 

Hey,

yes ubot would be locked out too,but a user and Ubot cannot do two things at the same time on the browser(I think....)

 

so unlock ,then ubot action(related to browser manipulation,click etc) followed by a lock

 

there would be better JS solutions too,like maybe create an invisible DIV tag rather than physically disabling buttons/links like my solution above,like some of those spam video websites

(because other things like inputs might still function) so if its of use to you I guess I can find some solution on the net for writing an invisible DIV tag but I wouldnt know off the top of my head how to write it

 

I really should have tested it in practice before posting but it should work,if it does than the invisible DIV tag would certainly be the right way to go,with the lock/unlock

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...