Open page in one browser in another or in source viewer - .spk

100 views
Skip to first unread message

Paul Norman

unread,
May 1, 2016, 3:55:15 AM5/1/16
to DroidScript
Hi,

Sometimes I've found myself needing to open a page I'm looking at in one browser in a source viewer app, or in another browser.

(For e.g. Firefox will put backgrounds in pdfs it makes but handles links poorly, while Chrome does links well, but doesn't show backgrounds in .pdfs it "prints".)

Couldn't find a consistent way of easily doing that between browsers abdsource viewer, without copying and pasting URLs all the time :-(

So here's a very little .spk that seems to do it nicely.

After first direct run it should appear in the Share menu in you browser. And in any app when you share selected text, if an http address was highlighted.

Works well from installed .apk

Use as you wish.

Paul
Open Browser.spk

Manuel Lopes

unread,
May 1, 2016, 5:24:58 PM5/1/16
to DroidScript
the spk not open what is wrong?i press in the icon and not open

Paul Norman

unread,
May 2, 2016, 6:35:09 AM5/2/16
to DroidScript
Hi Manuel,

You'll need to tell us more please.

Have you first downloaded the .spk?

Paul

Manuel Lopes

unread,
May 2, 2016, 8:29:55 AM5/2/16
to DroidScript
yes and put in the droidscript(accecpted) when try start with the droidscript not work not show nothing;this show anything how to work with this?thanks

Paul Norman

unread,
May 3, 2016, 9:06:01 AM5/3/16
to DroidScript
"After first direct run it should appear in the Share menu in you browser.
And in any app when you share selected text, if an http address was highlighted.

"Works well from installed .apk"

Run once to initialize - then it will show under any browser's Share menu item, and in some other apps when you use their Share menuitem - after highlighting some text first starting http://blahblah...

Paul

Manuel Lopes

unread,
May 3, 2016, 2:14:56 PM5/3/16
to DroidScript
this copy and open in the other browser now i understand thanks

Paul Norman

unread,
May 4, 2016, 8:52:07 AM5/4/16
to DroidScript
I suppose this is an example of an almost GUI-less DroidScript application, not worthy of PlayStore, but might inspire someone here :-)

Since I did the first version, I've actually noticed phone numbers that are in plain text, and web pages addressees in plain text (not as links) is something else I've had to copy, locate and open apps, and paste, etc quite a bit from browsers.

So here's a basic effort to better handle highlighted text in browsers, or other text displaying apps, that mark out a bare phone number, or web address.

It can anticipate a lowercase www or http style web address, will hopefully work for www.something.com etc, http://something.com(etc), and even a bare something.xxx.yyy etc, and also 012345678 etc, while baulking at any highlighted text that has any middle space(s) in it.

Don't know if its bullet proof, but has passed whatever I've thrown at it so far.

Please freely do whatever with it.

Make apk, install, run once directly to set it up for receiving "Shares".

Thereafter, in a browser web page either just use the browser's Share menuitem to activate (its called Open Browser), or highlight a bare phone number or plain text web address, and then use the app, your in', Share menuitem.

Paul

Open Browser 003.spk

Manuel Lopes

unread,
May 4, 2016, 9:38:47 AM5/4/16
to DroidScript
give error in this line
var num = Number.parseInt(text, 10);

Paul Norman

unread,
May 4, 2016, 1:12:47 PM5/4/16
to DroidScript
What version of Android are you on please?

I suspect this may be a JavaScript release issue.

Paul

Paul Norman

unread,
May 4, 2016, 1:53:56 PM5/4/16
to DroidScript
Ok according to MDN, that was a JavaScript versioning issue, sorry I should have caught it.

Here's a fixed version using the pre-2015 syntax, with an attempt to catch highlighted (selected) but non-hardwired, email addresses and initiate an email as well.

Incorporated Steve's suggestion for setTimer, and Girard's for showing the dialler so user can edit a phone number first if necessary, appoligies if I've missed out any one whose provided information or advice, thanks.

Paul

Open Browser 004.spk

Paul Norman

unread,
May 4, 2016, 2:33:53 PM5/4/16
to DroidScript
Going to have to change
if (sharedText.indexOf("http://") == -1 ){
sharedText = "http://" + sharedText ;
}

To
if (sharedText.indexOf("http") == -1 ){
sharedText = "http://" + sharedText ;
}

To allow for https:// when it is used.

Manuel Lopes

unread,
May 4, 2016, 4:59:27 PM5/4/16
to DroidScript
thanks now works

Paul Norman

unread,
May 9, 2016, 1:14:49 AM5/9/16
to DroidScript
Here's a version 005 with the allowance for https://
plus for those situations where Share is not available, if a web address, or email or phone number is placed on the clipboard (copied by User) in any app at all, and this app is then directly opened by User, it attempts to process what is on the clipboard appropriately.

I'm actually finding myself using it more than I thought would be necessary, some newspapers' online editions (for legal reasons perhaps?) often will show a web or email address, but not live link it.

Paul

Open Browser 005.spk
Reply all
Reply to author
Forward
0 new messages