I am trying to do a simple thing , navigate to an external url
Class Books
However I am getting a 404 because the Http// portion is being deleted I am not sure if this is an mvc thing or html thing. Here is link http://18.217.228.108/angularapp1.
Here is a link to a screen shot of me accessing url
https://gyazo.com/455b01f1ceded24f9b4ce6c58b0e10e1
Curious-programmer,
You must navigate using an absolute URL just when it is out of your domain such as https://www.amazon.com/
However, I've noticed that you are trying to navegate to a link inside your own domain using absolute URL when you must use relative URL like:
Class Books
Try
Anchor Test
and then try keying http://18.217.228.108/angularapp1/book/ into your browser url.
The link you are using is actually 404.
Based on the link given in updated question:
The new link you've given is an html page (which you can navigate to in the "normal way"). It links to an angular app with an anchor "Books". Clicking on "Books", whilst attaching "book/" to the url in the browser (the url you're trying to link to in your original question), is intercepted by the script and actually navigates to:
http://13.59.126.130/BuellerWebApi_deploy/api/book/getAll
which returns a Json object containing data to display on the same page.
(Your concern about the removal of the http:// in the anchor is a red-herring (try navigating to http://www.bbc.com - you will see www.bbc.com in the browser url). It's the way your app has been configured.)
So, as things stand, navigating to the anchor in your original question, whilst appearing to be a valid url, actually is not. Its a 404.
Related
I have a simple react application containing an iframe. I want to reference a paragraph inside that iframe that has a specific id. For example, having <p id="test">Test</p>, I would like to reference it with localhost:8000/my-local-iframe.html#test.
If I access this URL directly, it gives me a full view of the iframe, like it would be the main application. If I want to access this URL from an anchor, I get redirected to the homepage, in this case, localhost:8000.
A strange interaction I've noticed is that whenever I click the anchor while inspecting the page, I don't get redirected anymore and the link works as expected.
Can anyone explain why this happens and how could I avoid the redirect?
I am trying to create a new page and manually set its content. Because the url of a blank page with injected code is still about:blank, all of the relative links on the page are broken. Is there a way to set the url of the page without actually navigating to that url via goto?
I can think of two options:
Create a function to turn a relative path into a file:// URL.
Run a simple server. I wrote a post about that on my blog
In a React component I want to show a link. That link's url comes from props. In a browser dev tool tag's href shows correct url but on hover it shows something different. Actually it's a combination of my project main url and the url I want to show. On click it tries to got to that combined url and shows error. I console logged and the url coming to the component via props is correct. Doex
You should do assign your URL with http:// or https:// otherwise it will consider it as the local directory from your project.
Something like this:
I was working on tag and let say my domain was www.abc.com. If I use href="http://example.com" it does properly navigate to intended url. However if I use href="www.example.com" it doesn't navigate to intended url.
not properly navigate
properly navigate
properly navigate
I was reading the anchor specs in https://html.spec.whatwg.org, unfortunately could not find this specific case.
The browser must know if you want to link to another website or a different file/page of your own website. The browser always asumes that you want to link to a file on your own server if you do not specifiy the protocol.
In fact: The only reason you can leave the protocol out when typing a url into the addressbar of your browser is because the browser just asumes that you want to use the http-protocol. This is not possbile with urls inside the A tag.
If you don't specify an absolute url it will think it's a route inside your site.
Possible values using href attributes:
An absolute URL - points to another web site (like href="http://www.example.com/default.htm")
A relative URL - points to a file within a web site (like href="default.htm")
Link to an element with a specified id within the page (like href="#top")
Other protocols (like https://, ftp://, mailto:, file:, etc..)
A script (like href="javascript:alert('Hello');")
Because When you click on it.. Your Browser Will suppose he need to find this link in the same file extension.
Example: if your html file extension is e://tst.html
when click on tag at Browser it will go to e:// and search about file with name "www.google.com" and not find it..
Use not properly navigate to inform Browser you need to navigate to Another website
I'm still really new to this web server thing.. But, I'm deploying a web site using tomcat. And, I've got a jsp page that has a link in it:
The html for the link is pretty simple:
. When I deploy the website locally, this works fine (it opens a new window with page == href). But, when I run the website using https, instead of creating a new window with the url, it creates a new window and adds "www.website.com" on to the url for the page that contained the link.
I'm wondering:
Is this a behavior of tomcat's SSL encryption, or is it something else?
How would I get the desired behavior (the link opens up a new window with
url == "www.website.com"?
You need to add http:// to the front of the href attribute in your link to the external website.
So, instead of Link text, you need Link text.
The reason for this is that links without the protocol in front of them are treated as relative links, meaning the href property in your <a> tag will just be appended to the base URL of your site. See http://www.w3schools.com/tags/att_link_href.asp.