Link to Homepage is forwardslash - html

Im have the default routing and write a link to the Homepage in my view
Link
The generated content is a forward slash.
Link
This link works in Firefox but in IE8 no request is sent to the server when the link is clicked.
Is a forward slash a valid content in a link?
EDIT:
OMG, I tried to have an image inside the link but actually put an input type image there. The funny think is that it worked in Firefox.
Thats how my linked looked like:
<input type="image" src="/Images/buttons/btn_buy_more.gif" alt="" />
I will leave this question here so you have somebody to laugh about.

Url.Action isn't supposed to send a request to the server. It just generates a link address. Look at the generated URI in the HTML source of the rendered page. I'll bet it's the same in both browsers.
What I think you mean is that clicking the link is behaving differently for you. To figure out why, use Fiddler to examine the request the browser sends and the server's response.

Related

HTML Link not redirecting correctly - its navigating to www.oldpage.com/http://www.google.com?

Any one got any ideas why this is happening?
My html quite clearly is
www.google.com
However, when I click it, I am navigated to the incorrect URL.
In my case to -- http://localhost:8000/profile/1/www.google.com
Then the link is actually working. But the URL is wrong. You're using this URL:
"www.google.com"
But a browser has no way of knowing that this is another website. Structurally it's no different than, say, this:
"www.index.html"
Which is a perfectly valid name for a resource on your website.
To tell the browser that this should go to another website, include the protocol:
"http://www.google.com"
Or at least the // at the start to default to whatever the current page's protocol is:
"//www.google.com"
The URL You are using is
www.google.com
Which will not redirect to the site, You have to use it like this:
https://www.google.com
Ex.:
Working URL<br>
Not Working URL

How do I link to a URL that contains encoded forward slash?

Here's a page at the URL http://www.last.fm/music/45+King%2FTake+6
If I link to it in a page, using this HTML:
Link
then the browser 404s because it ends up here, at http://www.last.fm/music/45+King/Take+6. i.e., the %2F is decoded to /.
Why does that decoding happen? Why does a URL I can successfully paste into the browser not work as a link in a page? I feel like I'm going mad...
I noticed the "Here's a page" link in my question was working fine, while my link in a local static HTML file wasn't... that was confusing.
The difference is that locally my link was to the last.fm domain, rather than www.last.fm.
So, the link to last.fm redirects to the www.last.fm version, and in that redirection the %2F is decoded.
So I just need to link to www.last.fm instead!

HTML Link doesn't work properly sometimes

I am using a local server for my applications and sometimes when I created a button or a link to another page in a new tab, it turns out to not working properly. It's not always like this, but sometimes, might sound silly. I give example below.
Let's say my application is **programmingworld** which exists in www folder, then in index.html file, I create a link for a button like this
Download Codes</div>
When I open it in a browser and click the button, sometimes it goes to http://localhost/programmingworld/www.google.co.uk where nothing is displayed on the page. It supposed to be www.google.co.uk in the new tab where I can see the google homepage.
Can you please tell me why?
You should write:
Download Codes</div>
If you didn't write http:// at the the beginning of the hyperlink, it will be search you your local directories or files.
To make sure that the link goes to where you intend and not where it goes try adding // or http://.
Example:
Google
or
Google
With // it will try http and https.
You're missing https:// before www.google.co.uk
So you're markup should look like this:
<a href="https://www.google.co.uk">
<div class="button" id="button=popup">Download Codes</div>
</a>
you can also do it like this (no https):
<a href="//google.co.uk">
<div class="button" id="button=popup">Download Codes</div>
</a>
Because you haven't included the protocol in your URL. it must start with either http:// or https://
Also, remove the div from inside the anchor tag.
Your question suggests that you need to do a little bit more testing on basic html.
I would most definitely suggest using https://
I've had similar problems such as that, and in order to fix them try adding https.

Anchor with hash in href attribute is opening a new page

I have never seen this behavior. I have a simple hash link on a website. The link looks like this:
<a href='#view_123'>Click</a>
On my test server, when I click, it simply changes the url to
http://www.myserver.com/mypage.aspx#view_123
And the page does not redirect anywhere. However, when I push this same link to my live server, it causes the browser to redirect to:
http://www.myserver.com/www.myserver.com#view_123
This makes no sense to me. The only way around this is to put the full url of the page in the href with the hash appended to the end, but this is causing me other problems and is not what I want to do.
The only clue I've come across is the MIME type, but I'm pretty sure mine is correct as "text/html".
There is no javascript causing this. I can hover over the link, and the url hint in Chrome shows the incorrect url.
Have you tried changing the target tag?
<a href='#view_123' target='_self'>Click</a>
or
<a href='#view_123' target='_top'>Click</a>

Javamail: Send a HTML mail with an "unclickable" URL on it

I come with an issue that is giving me some headaches.
I'm sendind some e-mail confirmations, using JavaMail and an HTML template, that is written on the message content.
This HTML template, has a URL on it, but this URL is not wrapped into a tag, it's just a plain text inside the HTML body.
The problem is that the URL appears as a clickable link on the mail message, and that's not the behavior I'd like. I'd prefer the user to copy and paste the URL to the browser (security policies at work)
Have any of you done something like this ?
Thanks in advance
You can't. You cannot control how mail user-agents handle incoming mail. Mail clients do this for the convenience of the user. I fail to see how this is a security issue.
The only alternative is to put the URI in an attached image, but that would just annoy your users.
you could explicitly code the url to not be a clickable link (a without the href)... It will still appear as a link, but it won't be clickable.
EDIT: It seems the user below is correct.
EDIT2: It actually seems I may have been correct. I tried composing an email at
http://putsmail.com/tests/838716156f824732c7f5456122c38e
with the html:
<html>
www.google.com
<a>http://www.google.com</a>
</html>
and the second link appeared as text.
You can't explicitly insert html in the gmail client, but you can with your own.
EDIT:
I went back this morning and tried this html:
<html>
www.google.com
<a>http://www.google.com</a>
http://www.google.com
</html>
and only the second link was plaintext. Just FYI...
I've found a way to do this.
The key is to insert a zero width space (​) somewhere between the URL
So, I changed my URL from
http://my.site.com/somecontext?contextid=somekeyvalue
to
ht​tp://my.site.com/somecontext?contextid=somekeyvalue
And now the URL is not interpreted as a link by the mail clients, but it's still good for a copy-paste to the browser.
Thank you all for your help!