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

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.

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

How does Google Chrome resolve an URL starting with two slashes and a number?

I got this situation:
I generate static HTML pages through Jekyll, unfortunately, I set the config.yml _baseUrl = / , so when it's down, the href in the index.html becomes:
my first post
When I click the link in index.html:
http://localhost:4000/index.html
it turns out to be a reserve address:
http://0.0.7.224/01/10/first-posts.html
Then I had some tests and found out that //1 represent 0.0.0.1, and when a number comes after // in the URL, it represents a reserve IP address.
It works right in Safari. Why does Chrome act like that?
Use slash and dot (/.) before your URL address, like this:
this links to //1
According to http://www.w3.org/Addressing/rfc1808.txt
5. Examples and Recommended Practice
Within an object with a well-defined base URL of
Base: <URL:http://a/b/c/d;p?q#f>
the relative URLs would be resolved as follows:
5.1. Normal Examples
[…]
//g = <URL:http://g>
it point out //2016 represent net_loc not path.

onclick to forward request to other URL

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>

Django how to specify a base url

So there should be a very basic way to do this, but unfortunately I don't seem to be able to find it.
How can one set an Href link to point to the 'base website url' + the 'link', rather than adding the link to the current page.
I.e. if I'm at www.example.com/content1/
I want the search function to go to www.example.com/search/
and not www.example.com/content1/search
I could just specify "www.example.com/search/" but then if it page is deployed locally I end up with a bunch of links to non-existent pages or vice versa. How can I specify the The Base hosting URL using DJango (whichever the server is running, whether the hostname, the current server ip, localhost etc.).
The best way to do this is the name your urls and then use the url template tag. Example below:
First, name your views. Use something like:
urlpatterns = [
...
url(r'^search/$', views.search_view, name="search"),
...
]
In this example, you've got your url for your example.com/search/ view. It is named 'search', which can be used url template tags and using the reverse() function.
Next, in your template, use the url tag with your url name:
Search
You shouldn't need to add 'base website url' to your href, it is implied. Make sure href is prefixed with '/' to set and absolute path and no '/' for relative.
home
is the same as
home
and will work no matter which sub directory you are in
If you are on the homepage and you use the link:
sample
it will effectively equal:
sample
but that same link used on the page http://www.mywebsite.com/sample will equate to:
sample
using:
sample
Will always equate to the following no matter where on the site it is used:
sample
If you are using django consider using the url template tag as Alex suggested:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#url
Make the link point to /search.
Any link that starts with / is relative to the domain root (say, http://example.com/) whereas any other relative link is relative to the current URL.

xpath for HTMLagility pack on site with frames

I'm trying to extract all the station names which are encased in the left frame from http://www.raws.dri.edu/wraws/orF.html using HTMLAgility pack.
My Xpath string is currently //frame[#name='list'] at this point it returns the node but I can't seem to access any of it's child nodes. Ultimately I'm trying to return all the attributes that are in frameset[1]/html/body/[#a] which looks something like this :
<a onmouseover="popup('<font color=Black><strong> IDARNG1 RG2 Idaho (RAWS) </strong> </font> ',615,307);update('IDARNG1 RG2 Idaho (RAWS)',615,307,'idIAN1','raw');return true;" onmouseout="removeBox();removedot();" href="/cgi-bin/rawMAIN.pl?idIAN1">`
Here is what the browser is currently doing:
It opens http://www.raws.dri.edu/wraws/orF.html
It parses the source code, and perform another request for every <iframe> that appears on it.
That means you need to open manually the url the <iframe> is pointing to, which can be found in the src attribute. Below is an example:
string src = doc.DocumentNode.SelectSingleNode("//frame[#name='list']").GetAttribute("src", "");
string url = "http://www.raws.dri.edu/wraws/" + src;
The URL you're looking for is:
http://www.raws.dri.edu/wraws/orlst.html
Go and open it manually and you will see only the left sidebar is loaded.
Next time make sure you use a HTTP Web Debugger like Firebug or Fiddler, to see what is happening behind the scenes.