URL in HTML and URL for desired link are not the same - html

I am working with mining some links from a Chinese academic article database.
It appears that when I refresh the page to an article I'm looking at, or simply copy and paste a url, the url redirects to the database's home page rather than the article.
For example, the following link goes to my search results:
http://search.cnki.net/search.aspx?q=%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD
The first article's individual url is:
http://www.cnki.net/kcms/detail/detail.aspx?dbcode=CJFQ&dbName=CJFQ2016&FileName=KJDB201615009&v=&uid=
However, if you try to directly click on the article link or refresh the article page, it redirects to the database home page. Why is this happening? Is there any way to get a "stable" url to these articles?
One detail that may matter, although I'm not sure, is that the url in the HTML code to the individual articles is also different.
<a href="http://epub.cnki.net/grid2008/brief/detailj.aspx?filename=KJDB201615009&dbname=CJFDLAST2016" target="_blank">

It's not really up to you.
The website you are referring checks if the link you are opening is a direct link or was opened from another page on the same website.
This is probably to prevent embedding links of this website in other websites.
In short, it does not allow direct links to its articles.
You can see it by examining the header returned from the request.
Instead of 200 OK you get 302.
Which tells the browser to redirect to another location.
You can try and fool the website by adding a "Referer" header to your request.
If you look at the header
that works you'll see that there is one.
I did not try but I'm pretty sure it will work.

Related

Link is removing Http header

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.

A link with a differentiating ccTLD

I am using blogger. I am not an expert.
I'm trying to add an image on a post, with a link that differentiates according to the ccTLD you are on.
so for example, if you're on "example.blogspot .ca", the link attached to the image will be "example.blogspot .ca/p/blog-page_25.html"
And if you're on "example.blogspot .nl", the link attached to the image will be "example.blogspot .nl/p/blog-page_25.html"
And if you're on "example.blogspot .com", the link attached to the image will be "example.blogspot .com/p/blog-page_25.html"
Hopefully, you understand what I'm trying to say.
Can someone help me to do it?
If you want to add hyperlink of your blog to any of your post, you don't have to worry about ccTLD. This is because, blogspot automatically takes care this for you.
According to Google:
Country-specific domains is not a different blog address, but a domain redirect based on the country where you're currently located.(Source)
So use simple .com with your post/page url and anyone clicking on it will be redirected to appropriate ccTLD automatically.
You can even try this by yourself: Write your blog address with .com, it will load the page from the nearest server. In my case, if I hit example.blogspot .com, then it loads for me, example.blogspot.in.

How to get website URL in a SharePoint custom masterpage?

I'm making a custom masterpage and on the navigation bar, I would like to have a button which goes back to the current site main page. This masterpage will be use for other subsites as well. Is there a way for me to get the current site URL within the index file?
You can use URL Tokens to get your site URL.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="homelink">
</SharePoint:SPLinkButton>
Notice the URL token of ~site used in attribute NavigateUrl="~site/". You may have to use the $SPUrl command also.
<%$SPUrl:~site/myPage.aspx%>
You can also refer to this discussion for more usage examples.
NOTE: I haven't tried the above examples, but these should be sufficient to provide you a path to your answer.

Is there any way to request a page without displaying it?

If you link to something downloadable with a simple <a href, the user will download the file while staying on the current page. You can get this behavior with files that the browser has no plugin for (like .bin), or by sending a content-disposition header to force downloading.
Is there any method or header which keeps the user on the current page while still requesting the page? The idea is that the user clicks a link, the request is made, but the page doesn't change—like when downloading a file.
This could be done with an iframe I guess, which is not really pretty and makes another request when loading the page. Javascript is another obvious answer, but that's actually the reason for asking this question: compatibility with JS-less clients.
A form with the method set to HEAD is another ugly solution, but doesn't work anyway. Chromium ignores the method and simply performs a GET request...
Anymore ideas?
You could place an iframe on your page that is hidden. Then, give that iframe and id.
Use this id as the target of a link to the file you want to pull down.
I've created a demo at http://jsfiddle.net/dancrumb/N87nL/ to show you how this would work. Just style the iframe as being invisible and you're good to go
The page will load in the iframe, you'll stay on your page, it doesn't require JS. Oh boy!
Note that the iFrame doesn't have an initial value for src, so no request is made on page load.

I want to have a link to my facebook page from my blog

Every time I try to embed code that was recommended by another user, I get the same message: Could not retrieve id for the specified page. Please verify correct href was passed in.
All I want is something on my page that a reader can click to take them to my Facebook page. What am I doing wrong?
You can create a personal username for your account on facebook, check Facebook Usernames general information, creating a username will provide you with a custom url something like
www.facebook.com/YOURUSERNAMEHERE
you can easily add this to your blog by using the following html
Follow me on facebook
It would also be helpful if you post the code that you're trying to use currently, otherwise no one has any idea what you're trying to do.
If you just want a link in HTML to your facebook page, put this into your page:
My Facebook Page
The section that goes within the quotes should be the URL you see when you navigate to your Facebook page.
Are you talking about a Page or Profile?
For Pages, the Like Box plugin is probably the best option, and lets people like the Page right from your website: https://developers.facebook.com/docs/reference/plugins/like-box/
For your own Profile, there's Badges ( https://www.facebook.com/badges/ ) which you can use
If it's your own Profile and you want people to Subscribe to you ('Follow') - there's a subscribe button you can use for this: https://developers.facebook.com/docs/reference/plugins/subscribe/
i dont know why, but for some reason, you have to include the http:// before the link