onclick to forward request to other URL - html

I want to open a page on click of a link. Below is the link.
<a href='#' onClick=window.open('\\122.96.212.765\spread\form\5.0\tx1\NA\show\SPREAD_Show_ _33_PM\index_VIN_Test_ZASF91A.htm','_self') >CLICK HERE</a>.
But when i click the above link 404 error is displayed on the page as the URL is changing as below:
http://localhost:8080/122.96.212.765spreadform%05.SPREAD_Show_ _33_PMindex_VIN_Test_ZASF91A.htm
Please suggest, do i need to add ay extra code so that onclick even will work.

can try changing your \'s to /'s

As Geoff said, changing your backslash characters with forward slashes should solve your issue. I'm going to assume that because you tagged the question with spring and spring-mvc that you are trying to make this request to a Spring controller with a #RequestMapping matching the URL.
Your request is 404'ing because the actual request is being made to the incorrect URL because your backslash characters are causing issues with either parsing the URL, or generating the request URL. Because the request URL is malformed, it isn't getting picked up by your Spring Controller.
Fix your onclick URL and it should work.

The url used in your code,
"\\122.96.212.765\spread\form\5.0\tx1\NA\show\SPREAD_Show_ _33_PM\index_VIN_Test_ZASF91A.htm",
is syntactically incorrect.
The url does not have 'Scheme' part ("http:", "ftp:", etc.) and strange delimiter '\' are used instead of "/".
If valid url line "http://www.cnn.com/" is used, your code will work.
Try following:
<a href="#" onClick=window.open('http://www.cnn.com/','_self') >CLICK HERE</a>

Related

What does <a href=“?var=something “></a>

What does
In above tag what ? Does
I studying one web frame work and there it was mentioned during pagination topic.when we click on that link I can url followed by ?var=somevalue without slash in between
? indicates the start query string on the URL. Since it is at the start of the href value, it would go to the same route but with the new query string values.

use a class instead of id in a link

Is it possible to make a link that would normally go to an id:
<a href="http://example.com/page#someid">
instead go to a class:
<a href="http://example.com/page.someclass">
Would the page scroll wildly up and down, trying to reach all the elements with that class, or would it just do nothing?
It would do nothing, except look for a file called "page.someclass" at the server and most probably yield a 404. Please refer to the URL spec because you're wildly confusing CSS selectors with the 'hash' part of the URL.
Why don't just try it?
JS FIDDLE DEMO
If you are using a class als anchor link, your browser tries to open it as url, like in the example named above index.content. Because he is not able to find it, you will receive an 404 not found or 403 forbidden error.

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

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.

Facebook share URL with get parameters

I'm trying to generate a share URL with get parameters and it's doing some double encoding shenanigans.
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3Dkeyword" />
produces an error url while
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bing.com" />
is fine. Anyone have ideas?
Facebook share link needed to be cached on their side. This has since be resolved on facebooks end.