Page 1 of 1

Display webpage without browser function

Posted: Wed Aug 13, 2014 8:27 am
by Saman Sjr.
Dear all,
how do i display webpage in an image area without browser function?

regard's
Saman Sjr.

Re: Display webpage without browser function

Posted: Wed Aug 13, 2014 9:34 pm
by Simon
Hi Saman,
Now this is an odd request :)
Are there images in the html page? Is there javascript in the page?
I'm trying to guess why you'd want a webpage as an image... Here lets waste some time together;

Code: Select all

set the filename of img 1 to url("http://www.mycrazysite.com/myImage.jpg")

Code: Select all

set the htmlText of fld 1 to url("http://www.myTimeSpent.com/guessingAtTheQuestion.html")
export snapshot from fld 1....
In Windows you do a prtSc of your browser and save it as an image.

HoHum, do I go on?

Simon

Re: Display webpage without browser function

Posted: Thu Aug 14, 2014 1:55 am
by Saman Sjr.
Hello Simon,

maybe i'm made a wrong explanation about the browser function.
actually what i want is how to disable a link in browser object (image area).

nice to meet you Simon.

Re: Display webpage without browser function

Posted: Thu Aug 14, 2014 6:39 pm
by Simon
Hi Saman,
Is "on browserBeforeNavigate" what you are looking for?
If you know the URL (or part of it) then you can block it.

Simon

Re: Display webpage without browser function

Posted: Fri Aug 15, 2014 1:19 am
by Saman Sjr.
Simon,
it's my first time learning about internet related stuff with livecode,
hope you can give detail example "on browserBeforeNavigate".

Kind regard's
Saman Sjr.

Re: Display webpage without browser function

Posted: Tue Dec 16, 2014 9:13 pm
by sturgis
if you look in the dictionary under browserbeforenavigate, you can see that its does what it says. The message fires before the navigation actually occurs.

Near the bottom of the dictionary entry it says this: "To prevent the navigatation from occurring, set the global variable browserCancel to true."

so, to stop navigation from happening something like this should work..

Code: Select all

on browserbeforenavigate pInstance,pUrl
global browserCancel -- define the scope.. I think this is necessary.  
put true into browserCancel -- sets the variable to true so LC knows to cancel the navigation.

end browserbeforenavigate
You could always check the URL of course to see if you actually want to cancel or not.

Re: Display webpage without browser function

Posted: Fri Jan 23, 2015 4:06 pm
by rickychou
sturgis wrote:if you look in the dictionary under browserbeforenavigate, you can see that its does what it says. The message fires before the navigation actually occurs.

Near the bottom of the dictionary entry it says this: "To prevent the navigatation from occurring, set the global variable browserCancel to true."

so, to stop navigation from happening something like this should work..

Code: Select all

on browserbeforenavigate pInstance,pUrl
global browserCancel -- define the scope.. I think this is necessary.  
put true into browserCancel -- sets the variable to true so LC knows to cancel the navigation.

end browserbeforenavigate
You could always check the URL of course to see if you actually want to cancel or not.
So sorry but i still can not understand it clearly :((((

Re: Display webpage without browser function

Posted: Fri Jan 23, 2015 4:34 pm
by sturgis
If a user clicks on a link, before the navigation to the new URL is done, the message "browserbeforenavigate" is sent.


Say you have a page with 3 links on it. And you only want one of the links to actually do something..
If your links are:
htp://www.myurl.com/link1
htp://www.myurl.com/link2
htp://www.myurl.com/link3

And you only want link2 to work you can set things up like this..

Code: Select all

on browserbeforenavigate pInstanceid, pUrl -- pInstancId is the id of the browser, pUrl is the link clicked.
    if pURL is not "http://www.myurl.com/link2" then put true into browserCancel -- will cancel any link except link2

end browserbeforenavigate

Re: Display webpage without browser function

Posted: Fri Jan 23, 2015 5:47 pm
by FourthWorld
With great power comes great responsibility.

There may be many good reasons to alter the behavior of links from pages hosted on your own site, but altering the behavior of links from sites owned by others can be viewed as hijacking that link.

For example, we could open a page with a link to the user's bank, and then route the request to a page we've designed to spoof the bank to obtain the user's login credentials.

If the user discovers any form of link hijacking on their own (any differences in behavior between how a page reacts to links in your browser vs. any other browser), in these security-conscious times they may become suspicious of all URL handling within your app. Given the speed with which things flow through social media, any minor mistake can quickly become a PR nightmare.

Tread carefully.....