Pass a variable that contains a Link on a real link
Moderator: Neosoft Support
Pass a variable that contains a Link on a real link
Hello;
I need to pass a variable that contains a Link on a real link. For example: that when you type www.neosoftware.com you will actually see the link.
I have tried some scripts in JS but they have not worked .... Any idea or action that works?
Regards!!
I need to pass a variable that contains a Link on a real link. For example: that when you type www.neosoftware.com you will actually see the link.
I have tried some scripts in JS but they have not worked .... Any idea or action that works?
Regards!!
Re: Pass a variable that contains a Link on a real link
Sorry, I do not understand the problem...
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
http://sinlios.com
Re: Pass a variable that contains a Link on a real link
Something like this?
http://yourswebsite.com/?myvar=myvalue
In many cases, it will take you to the website without error. If you needed to process that variable's value on the server side, you'd need to have a php / asp / aspx file to do that.
http://yourswebsite.com/?myvar=myvalue
In many cases, it will take you to the website without error. If you needed to process that variable's value on the server side, you'd need to have a php / asp / aspx file to do that.
David Payer
Des Moines, Iowa
USA
Des Moines, Iowa
USA
Re: Pass a variable that contains a Link on a real link
Hello!
I wanted to say that for example if I have a String that says "Hello, visit me on my website http://www.mi-sitio.com" is returned: "Hello, visit me on my website <a> http://www.mi-sitio.com </a> ".That is, that links are recognized in a string and that they are shown as such, and not as a simple text.
Spanish:
Quise decir que por ejemplo si tengo una String que diga: "Hola, visitame en mi página web http://www.mi-sitio.com" se devuelva: "Hola, visitame en mi página web <a>www.mi-sitio.com</a>". O sea, que se reconozcan links en una strings y que se muestren como tal, y no como un simple texto
Thanks!
I wanted to say that for example if I have a String that says "Hello, visit me on my website http://www.mi-sitio.com" is returned: "Hello, visit me on my website <a> http://www.mi-sitio.com </a> ".That is, that links are recognized in a string and that they are shown as such, and not as a simple text.
Spanish:
Quise decir que por ejemplo si tengo una String que diga: "Hola, visitame en mi página web http://www.mi-sitio.com" se devuelva: "Hola, visitame en mi página web <a>www.mi-sitio.com</a>". O sea, que se reconozcan links en una strings y que se muestren como tal, y no como un simple texto
Thanks!
Re: Pass a variable that contains a Link on a real link
Palamar:
... and it displays as expected.
If you want the website page to be opened in a new tab/window (at least on desktop browsers), you can add target="_blank".
In a Container object, I placed this text in the HTML property ...I wanted to say that for example if I have a String that says "Hello, visit me on my website http://www.mi-sitio.com" is returned: "Hello, visit me on my website <a> http://www.mi-sitio.com </a> ".That is, that links are recognized in a string and that they are shown as such, and not as a simple text.
Code: Select all
<a href="https://www.neosoftware.com">Visit NeoSoft Corp</a>
If you want the website page to be opened in a new tab/window (at least on desktop browsers), you can add target="_blank".
Re: Pass a variable that contains a Link on a real link
No, what I need is for the program to recognize when it is a link, for example if it starts with http, or https, or www or ends in a .com. That converts that part into a link (from text to link). The initial text would be for example in a variable.
Thank you!
Thank you!
Re: Pass a variable that contains a Link on a real link
Palamar:
I can give it a go ... but first, let us nail down all the cases of text patterns that need to be "wrapped" ...
a) starts with (space)http:// ... until another (space)
b) starts with (space)https:// ... until another (space)
c) starts with (space)www. ... until another (space)
d) starts with (space) ... until .com(space)
Any other case ?
It can be done with Javascript ... the hard part is parsing the text to identify such patterns ... then, wrapping the html tags around them is the easy part.what I need is for the program to recognize when it is a link, for example if it starts with http, or https, or www or ends in a .com. That converts that part into a link (from text to link). The initial text would be for example in a variable.
I can give it a go ... but first, let us nail down all the cases of text patterns that need to be "wrapped" ...
a) starts with (space)http:// ... until another (space)
b) starts with (space)https:// ... until another (space)
c) starts with (space)www. ... until another (space)
d) starts with (space) ... until .com(space)
Any other case ?
Re: Pass a variable that contains a Link on a real link
Take a look at this:
http://soapbox.github.io/linkifyjs/
And also this one:
http://stackoverflow.com/questions/3768 ... with-links
http://soapbox.github.io/linkifyjs/
And also this one:
http://stackoverflow.com/questions/3768 ... with-links
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
http://sinlios.com
Re: Pass a variable that contains a Link on a real link
Gaev, I think those cases would be enough, the problem is to find the link in the middle of a String.
Luishp I saw before both links, the library did not finish understanding how to use it, I have already used others successfully but I do not achieve anything with this one. I would put an example of the script to use it in Neo? ... because the example that mentions on the web gives an error ...
Greetings and thanks!
Luishp I saw before both links, the library did not finish understanding how to use it, I have already used others successfully but I do not achieve anything with this one. I would put an example of the script to use it in Neo? ... because the example that mentions on the web gives an error ...
Greetings and thanks!
Re: Pass a variable that contains a Link on a real link
Palamar:
Finding (and changing) strings in the middle of the text was not an issue ... I just looked for the string with a space before it.
But I came across some exception cases that I need to discuss with you ...
a) the text starts with "http://" or "https://" etc. i.e. no leading space ... if you need to include this scenario, there is more logic (code) required to handle it ... if not required (i.e. there will always be some text and a space before the first link), let me know.
b) I am not sure how the text string will be composed ... I look for a space after "http://" or "//https:" to extract the link ... this may not always be true e.g. there is a <br/> or NeoBook's "CRLF" ([#13][#10]) at the end of the link ... can you advise if there is always going to be a space after the link e.g.
... including if a link is the very last part of the text string.
I did some experimenting on the weekend ... using NeoBook (and its native commands only), I was able to achieve a lot.Gaev, I think those cases would be enough, the problem is to find the link in the middle of a String.
Finding (and changing) strings in the middle of the text was not an issue ... I just looked for the string with a space before it.
But I came across some exception cases that I need to discuss with you ...
a) the text starts with "http://" or "https://" etc. i.e. no leading space ... if you need to include this scenario, there is more logic (code) required to handle it ... if not required (i.e. there will always be some text and a space before the first link), let me know.
b) I am not sure how the text string will be composed ... I look for a space after "http://" or "//https:" to extract the link ... this may not always be true e.g. there is a <br/> or NeoBook's "CRLF" ([#13][#10]) at the end of the link ... can you advise if there is always going to be a space after the link e.g.
Code: Select all
(space)http://www.website.com(space)
(space)http://www.website.com?name=Smith(space)
Re: Pass a variable that contains a Link on a real link
I see that this code works for me, what happens is that when the variable changes text it still shows the previous link. Is there any routine that changes the "each" to just that div ...?
Code: Select all
$('p').each(function(){
$(this).html( $(this).html().replace(/((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g, '<a href="$1">$1</a> ') );
});
Re: Pass a variable that contains a Link on a real link
Gaev,
The String may or may not contain a space before, since it will be entered by the user in an InputBox. So you should use a syntax in which you always recognize the link in the middle of a more lake text, for example:
"Hello Juan, my page is www.juan.com, visit it"
or
"Www.juan.com, this is my web"
or
"Juan.com" ..
Regards!
The String may or may not contain a space before, since it will be entered by the user in an InputBox. So you should use a syntax in which you always recognize the link in the middle of a more lake text, for example:
"Hello Juan, my page is www.juan.com, visit it"
or
"Www.juan.com, this is my web"
or
"Juan.com" ..
Regards!
Re: Pass a variable that contains a Link on a real link
Palamar:
1) Input Box does not allow multi-line text ... so this makes the logic a bit simpler.
2) Link text beginning at the first character can also be handled
3) However, from your examples, I see that link text can be immediately followed by a comma ... if this is expected/allowed, then it is another pattern that needs to be searched (not just ending with a space) ... let me know if links can end with characters other than a space ... if so ...
a) what other characters can they end with ?
b) do all links end with .com ... or other domain names (like .edu, .org, .uk etc.) also expected/allowed
1) Input Box does not allow multi-line text ... so this makes the logic a bit simpler.
2) Link text beginning at the first character can also be handled
3) However, from your examples, I see that link text can be immediately followed by a comma ... if this is expected/allowed, then it is another pattern that needs to be searched (not just ending with a space) ... let me know if links can end with characters other than a space ... if so ...
a) what other characters can they end with ?
b) do all links end with .com ... or other domain names (like .edu, .org, .uk etc.) also expected/allowed
Re: Pass a variable that contains a Link on a real link
hello!:
There was a routine in Neobook (the usual) that allowed reading a String from another, here would need something similar. It does not matter if it ends with .com, .edu. Net. Or whatever, if it is a link it should convert it to such. I understand that to do the routine we should detect the beginning that could well contain these beginnings:
And the endings that could have these:
There was a routine in Neobook (the usual) that allowed reading a String from another, here would need something similar. It does not matter if it ends with .com, .edu. Net. Or whatever, if it is a link it should convert it to such. I understand that to do the routine we should detect the beginning that could well contain these beginnings:
Code: Select all
(Http, https, www)
Code: Select all
(.com .net .org .info .tv .biz .ws. Com.ar)
Re: Pass a variable that contains a Link on a real link
Palamar:
And things get really complicated when you want to allow such links to be preceeded/succeeded by characters other than spaces ... now you are trying to do AI using NeoBook.
And if you allow such links to be preceeded by characters other than a space, how can the logic differentiate between ...
2) one of your choices is .com.ar ... which would require a lot of logic to make sure the link is not cut off after .com ... UK and many countries in the British Commonwealth use such patterns ... as well as .org.xx, .edu.xx etc. etc. ... so you can see that the patterns to check soon multiply beyond resonableness.
Bottom line, you have to place some restrictions on the patterns in order to get even Regex to give you the results you need. I think that requiring "a space" before the link (except the first one) and "a space or comma or dot" after it would go a long way towards reducing the logic ... then, having "a finite number of link endings" would keep the logic to a manageable level.
In any case, I can't develop any logic until the specifications are nailed down ... because the "devil is in the details" ... and the design depends on the specifications.
More easily said than done ... do you know how many different domains there are out there ? ... even using Regex (like the references in posts by luishp and you), it takes a huge amount of logic to accomplish.It does not matter if it ends with .com, .edu. Net. Or whatever, if it is a link it should convert it to such.
And things get really complicated when you want to allow such links to be preceeded/succeeded by characters other than spaces ... now you are trying to do AI using NeoBook.
But you also want to catch strings like juan.com i.e. ones that do not begin with Http, https, www ... so, if there is text like "visit my websitejuan.com", how does the logic know where your link starts ?I understand that to do the routine we should detect the beginning that could well contain these beginnings: (Http, https, www)
And if you allow such links to be preceeded by characters other than a space, how can the logic differentiate between ...
Code: Select all
www.abc.com
and
subdomain.www.abc.com
1) are these the only ones you are interested ? ... or are these just examples ?And the endings that could have these: (.com .net .org .info .tv .biz .ws. Com.ar)
2) one of your choices is .com.ar ... which would require a lot of logic to make sure the link is not cut off after .com ... UK and many countries in the British Commonwealth use such patterns ... as well as .org.xx, .edu.xx etc. etc. ... so you can see that the patterns to check soon multiply beyond resonableness.
Bottom line, you have to place some restrictions on the patterns in order to get even Regex to give you the results you need. I think that requiring "a space" before the link (except the first one) and "a space or comma or dot" after it would go a long way towards reducing the logic ... then, having "a finite number of link endings" would keep the logic to a manageable level.
In any case, I can't develop any logic until the specifications are nailed down ... because the "devil is in the details" ... and the design depends on the specifications.