SITE

317 views
Skip to first unread message

Alan Viana

unread,
Mar 15, 2024, 10:45:12 AM3/15/24
to mementodatabase
IS IT POSSIBLE TO SET A WEBSITE TO OPEN WITHIN THE SYSTEM USING JAVA SCRIPT?

Bill Crews

unread,
Mar 15, 2024, 11:08:24 AM3/15/24
to Alan Viana, mementodatabase
Well, first, you don't need JavaScript to just open a page. Include a Hyperlink field in your library, as an entry in which you place a Web site URL into the Hyperlink field. When you view the new entry, you can tap or click on the Hyperlink field to open that page in the default browser.

If you really need it in JavaScript, you can use the Http object. See the wiki page for that here...

See examples of its use here...

On Fri, Mar 15, 2024, 10:45 AM Alan Viana <avdespa...@gmail.com> wrote:
IS IT POSSIBLE TO SET A WEBSITE TO OPEN WITHIN THE SYSTEM USING JAVA SCRIPT?

--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/604ed9f3-69b0-455d-978a-fe600dca27f5n%40googlegroups.com.

Er Mo

unread,
Mar 15, 2024, 12:30:12 PM3/15/24
to mementodatabase
Hallo
Mit den Feldtyp " Schaltfläche " kann auch eine URL geöffnet werden .

Hello
A URL can also be opened using the “Button” field type.

Ernst

Alan Viana

unread,
Mar 15, 2024, 12:40:34 PM3/15/24
to mementodatabase

entendi o que falaram, mais queria que um site abrisse direto dentro do sistema, sem ir pro navegador padrao, ou em um widget

Bill Crews

unread,
Mar 15, 2024, 12:44:19 PM3/15/24
to Alan Viana, mementodatabase
It is not clear what you mean by "the system". Memento itself does not contain a Web browser. The normal way a Web site is opened is by initiating the default Web browser. It happens automatically when you tap or click on the Hyperlink, so it is immediate.

Nobody (PeteMcTee)

unread,
Aug 1, 2024, 8:34:19 AM8/1/24
to mementodatabase
This is a similar question so, I thought I'd post here.

I have library with a hyperlink field and I would like to make a button on the entries list that opens the website in the hyperlink field without having to open the entry. (The hyperlink field contains a ups tracking links for parts but the example below is just a dummy hyperlink) Currently, I'm using JavaScript and have it set to "Entries in the list" as place of action. 


I'm assuming it's not working due this? -

"HTTP requests must fulfill two requirements:
  1. Script execution must be asynchronous, so HTTP requests go in the last Phase of an Event."

I have tried various configurations but this one, I thought seemed most right to me.

e = entry();
tlink = e.field('Tracking Link#1');
http().get(tlink);

I get this error 
"org.mozilla.javascript.Evaluato rException: Can't execute http get request, error: Expected URL scheme 'http' or 'https' but no colon was found 
java.lang.IllegalArgumentException (opening a tracking link.js#3)"

But when I run this 
e = entry();
tlink = e.field('Tracking Link#1');
message(tlink);

It is giving me a correct format


Any help would be appreciated


Bill Crews

unread,
Aug 1, 2024, 8:59:46 AM8/1/24
to Nobody (PeteMcTee), mementodatabase
Your error from http:get() suggests the text value of the Hyperlink field goes not include a colon. Your example call to message() demonstrates that the field contains a colon. Did the original, actual field value contain a colon? If not, maybe it's the field value that needs fixing. If you prefer a URL without a prefix, you could prepend the field value with "http:" + tlink or "https:" + tlink or "http://" + tlink or "https://" + tlink. If you want all these formats to work, maybe you need to check the front of a field value for a prefix and add one if not present.


David Gilmore

unread,
Aug 1, 2024, 9:49:50 AM8/1/24
to mementodatabase
In this forum display, there appears to be a blank in the middle of the http string (right after "webhp?"). is this true?  Embedded blanks in a url are not allowed, you need to substitute "%20" where ever there is a blank.

Nobody (PeteMcTee)

unread,
Aug 1, 2024, 10:11:19 AM8/1/24
to mementodatabase
@Bill -  It appears to have a colon to me. Attached is a copy of my log. (Every time I run this log I get two entries like this, is that normal?)

e = entry();
tlink = e.field('Tracking Link#1');
log(tlink);

@aa6 - sorry I think that was a copy-paste error using google lens. The real one does not have a space.

log.jpg

Nobody (PeteMcTee)

unread,
Aug 1, 2024, 10:34:19 AM8/1/24
to mementodatabase
@bill - Interestingly, if I use this code the script executes but does not open the website. I also tried appending with "http:" & "https:" but get errors I had trouble implementing "https://" because it is reading "//" as a comment even tho it has ""?

e = entry();
tlink = e.field('Tracking Link#1');
http().get("" + tlink);

Nobody (PeteMcTee)

unread,
Aug 1, 2024, 10:36:31 AM8/1/24
to mementodatabase
Sorry for the message bombs

When I mean open a website. I meant, I want it to physically take me out of Memento and display the website. Not sure if my original explanation was clear about that.

Er Mo

unread,
Aug 1, 2024, 1:02:52 PM8/1/24
to mementodatabase
Hallo
Hast du bei den Versuch mit " HTTP: " das "http: " vom Ursprünglichen Text entfernt ? Nicht das es 2 Mal vorkommt .

Hello
Did you remove the "http:" from the original text when you tried using "HTTP:"? So that it doesn't appear twice.

Ernst

Bill Crews

unread,
Aug 1, 2024, 1:04:21 PM8/1/24
to Nobody (PeteMcTee), mementodatabase
It was unclear if you meant browser display or some idea of a special in-app display, but browser display is the way Memento does it and the right way according to me. 


Nobody

unread,
Aug 1, 2024, 1:23:30 PM8/1/24
to Bill Crews, mementodatabase

I tried removing the https:// and tried appending all variations of http - the script executes with no errors but doesn't display the website. I also tried changing the field's website to the http variations without the appending and they also all execute properly but do not display the website. I also tried making a new library with only the hyperlink field and got the same result.

Nobody (PeteMcTee)

unread,
Aug 3, 2024, 7:33:25 AM8/3/24
to mementodatabase
Does http().get() not work for anyone else for opening websites?

Mmm

unread,
Aug 3, 2024, 8:19:54 AM8/3/24
to mementodatabase
Ссылка откроется в браузере по умолчанию:

let e = entry();
let url = e.field('Tracking Link#1');

let i = intent("android.intent.action.VIEW");
i.mimeType("text/html");
i.data(url);
i.send();

суббота, 3 августа 2024 г. в 14:33:25 UTC+3, pete...@gmail.com:

Nobody (PeteMcTee)

unread,
Aug 3, 2024, 8:34:46 AM8/3/24
to mementodatabase
Thank you! I really appreciate your help Mmm.  

Nobody (PeteMcTee)

unread,
Aug 3, 2024, 9:01:03 AM8/3/24
to mementodatabase
This has so many more uses than what I just asked for. I am so happy right now. <3 
Reply all
Reply to author
Forward
0 new messages