HTML href Link is not clickable - html

I want to send the following snippet to my gmail account, however it does not resolve into a clickable link in the email I recieve.
Link
Full Code (JavaScript / Google Apps Script)
function test() {
GmailApp.sendEmail("X.X#gmail.com", "Mail Subject", "",{ htmlBody: "<a href='evernote:///view/XXXXXXX/sXX/f473d94d-ac3d-43d0-a838-0c9f55d622c6/f473d94d-ac3d-43d0-a838-0c9f55d622c6/'>Link</a>"} );
};
When I put the snippet into another editor ( e.g. http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic) , the html resolves into a clickable link as it should.
What am I missing here?
(Btw. Link works fine, so there is a problem with the evernote:/// url type)

URL should have http:// or https://

evernote:/// is not a protocol that everybody understands. Even if you put the same link in your browser it will not work. As the previous answer suggests, you must link your href tag to a http:// or https:// protocol.
Although the w3schools page creates a link out of it, nothing happens when you actually click it.

Try this
String body= HttpUtility.HtmlDecode("Link");
Pass the string body as parameter

Related

Href without http(s) prefix

I just have created primitive html page. Here it is: example
And here is its markup:
www.google.com
<br/>
http://www.google.com
As you can see it contains two links. The first one's href doesn't have 'http'-prefix and when I click this link browser redirects me to non-existing page https://fiddle.jshell.net/_display/www.google.com. The second one's href has this prefix and browser produces correct url http://www.google.com/. Is it possible to use hrefs such as www.something.com, without http(s) prefixes?
It's possible, and indeed you're doing it right now. It just doesn't do what you think it does.
Consider what the browser does when you link to this:
href="index.html"
What then would it do when you link to this?:
href="index.com"
Or this?:
href="www.html"
Or?:
href="www.index.com.html"
The browser doesn't know what you meant, it only knows what you told it. Without the prefix, it's going to follow the standard for the current HTTP address. The prefix is what tells it that it needs to start at a new root address entirely.
Note that you don't need the http: part, you can do this:
href="//www.google.com"
The browser will use whatever the current protocol is (http, https, etc.) but the // tells it that this is a new root address.
You can omit the protocol by using // in front of the path. Here is an example:
Google
By using //, you can tell the browser that this is actually a new (full) link, and not a relative one (relative to your current link).
I've created a little function in React project that could help you:
const getClickableLink = link => {
return link.startsWith("http://") || link.startsWith("https://") ?
link
: `http://${link}`;
};
And you can implement it like this:
const link = "google.com";
<a href={getClickableLink(link)}>{link}</a>
Omitting the the protocol by just using // in front of the path is a very bad idea in term of SEO.
Ok, most of the modern browsers will work fine. On the other hand, most of the robots will get in trouble scanning your site. Masjestic will not count the flow from those links. Audit tools, like SEMrush, will not be able to perform their jobs

Url redirection error in AngularJs

google
when i clicked on this tag than i redirected to
http://localhost:55943/www.google.com
I tried below code also,
$window.location.href = "www.google.com";
but both case I redirected to
http://localhost:55943/www.google.com page.
A href without a protocol definition will always be treated as a relative URL. You need to type http://www.google.com in order for it to be understood as an absolute URL.
Update your HTML to:
google
Also take a look at the W3 explanation of the HREF attribute.
As GordyD says, if you don't define any protocol it will be treated as a relative URL.
You need to prefix external URLs with http://, https:// or //
// will open the external url using the same protocol as your current application is running

Force navigator to Open Link in New Tab by URL

i have a request if possible,
i have an interface which containts a table :
name of application url
XXXXXX www.xxx.com
Problem is when I click in the url I lose my information on my current page.
my question is there is a code language by Internet explorer FF chrome... provide this action
open in tab this url to put in the url like the method version and the other
like this about:version ==> open in new tab : this url to put in the url navigator
and we get a new tab
thank you for help .
i try open in a new tab by tools provided by IE , but if possible provide a solution like a code entered in url to open a new tab
If I get you, you want your link to open the page in another tab.
You may use the target attribute of the link like this :
<a href="somepage.html" target=newtab>text</a>
If you want something you can type in the URL field of the browser, that is a bookmarklet, you may use this :
javascript: window.open('http://www.dystroy.org');
In most browsers, ctrl-click a link do the same thing.
EDIT :
If what you can modify is only the href attribute of the link, you can make this href be like this :
<a href="javascript:window.open('http://www.dystroy.org');" target=_blank>text</a>
If its a hyperlink just add a "target" to the hyperlink with its value as "_blank". Working example:
<a id="termsLink" href="www.someLink.com" target=_blank>
Terms and Conditions</a>
The java script solution works great in case of shortcodes which offer you an href (or url) option but no target parameter. Here is an example with a popular callout shortcode:
[callout title='Your big Title' text='your small text...' button_text='CLICK ME' button link="**javascript:window.open**('http://www.dystroy.org');"]
Without the javascript, the linked page would open onto the current one.
You don't need any code to open a link in a new tab or window. HTML already has that functionality built in.
Use an tag to show your url and use the target attribute to tell it to open in a new window.
Example:
www.xxx.com
Learn more about a tag and target attribute here

How do I get link to show HTML source?

I'd like my web page to have a "Show Source" link that will show the source of my HTML.
I'm also wondering if there's something I could append to the URL of my page that'll just show the source as opposed to rendering the page. Like this...
http://www.example.com/mypage.html#show_source
If you are okay with a link that opens source, you could use the following javascript:
if you are using FF:
window.location = "view-source:" + window.location.href;
and with IE:
var popup=window.open();
popup.document.open('text/plain').write(document.documentElement.outerHTML)
If all you need is code between the body tags - then you could do the following:
document.body.innerHTML
Can you provide a bit more information on the application?
"View Source Button" could be a solution, but if you need a direct link you need to change the Content-Type Header of your file to "plain/text".
If your page could be, for example, a PHP script, it would be:
<?php if($_GET["viewsource"]=="yes") header("Content-Type: plain/text"); ?>
and you can open link by appending ?viewsource=yes to your URL.
Remember, it works only "server side".

How to pass request URL to mailto body

I need to pass URL to the body part of the mailto link.
Sample URL :
www.test.com?param1=value1&param2={value2}
If i pass this URL, it's cut down after the '&'. So, i have tried to encode the URL like below:
www.test.com%3Fparam1%3Dvalue1%26param2%3D%7Bvalue2%7D
It works, but the URL is not readable. How can we achieve this without encoding or showing readable URL in the mail body?
Try this bit of code:
Send Mail' with current webpage (offline mode will send file location on disk).
When is doubt, read the specification:
http://shadow2531.com/opera/testcases/mailto/modern_mailto_uri_scheme.html
Validator available at the bottom of the page.