I am using this syntax to refesh the page I am in:
<i class="fa fa-undo"></i>
The result of this command is, for example:
<i class="fa fa-undo"></i>
Which seems right.
This doesn't work with the anchor (#end), but works without. It only goes to the anchor, but never reload. Why is this? Is this only because I am in the same page, or is there another reason?
That's standard browser behavior, unrelated to Play. If the link contains an anchor and the user is already on the page the browser will just scroll to the anchor position.
Does it need to be an anchor? You could change it to a regular query string parameter (/instance/logs/1?end) and use javascript to check for the parameter and scroll the page.
Related
I have a link on a page like this
use our contact form.
Then in about-us.php I have
<div class="extra" id="contactform">
When I click the link, the browser takes me to the correct page BUT
The address bar momentarily flashes up "about-us.php#contactform"
Then it falls back to "about-us.php#" and the browser doesn't move to the anchor.
This is so simple, yet I can't see what is causing it. I have several other anchors with exactly the same format that are working. I also have a link that is called from PHP to the same anchor, and that works.
Mystified!
PROBLEM SOLVED
It was the PHP and Javascript bit of the overall page code that caused the problem. It was overriding the anchor link. Having wrapped the javascript in a PHP if() statement, it is under control.
Moral of the story: look at everything and not just the bits close to the apparent problem.
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>
I’m trying to make web scraping in a web page, but there is code that I can’t reach. The part of the code of the page that I cannot achieve is accessed through an anchor tag. In the html is:
<a class="MTLink" href="#d192633539-47" title="example" >
But when I click on "#d192633539-47" does not appear what is intended, ie not appear that appears when I click on the link on the page. Instead appears another page.
Related to this I have also
<li id="d192633539-47" class="MainTabContent Hidden" tnIndex="192633539">
Someone can help me? What could be happening?
This element is controlled by JavaScript. Without tracing the JS code you cannot determine the intention of the click event.
There might be a problem with wrong cookie handling. Check it out.
Within a standard SharePoint publishing site, editing the homepage, entering lots of content and then placing a link to the top of the page using the following anchor link doesn't work:
back to top
Clicking on the link above does nothing. However, other named anchors (such as
<a name="test"></a>
and
work fine.
Has anyone come across this issue before?
<a href="#" /> is not supposed to bring you to the top of the page. It targets the empty fragment and basically neuters the default behavior of the link most of the time.
I suspect your <a name="#" /> solution is relying on an artifact of your browsers, because an anchor named # should be called ## (or more probably #%23) in the href attribute of the link.
Since you have to create an anchor anyway, it might be best to give it a meaningful name like TOP and target it using back to top.
I've gotten around it by placing
<a name="#"></a>
at the top of the page, but it would be good to find out why it doesn't work normally, and if there are any other nicer solutions out there.
For example, the link below triggers something in jQuery but does not go to another page, I used this method a while back ago.
<a class="trigger" href="#"> Click Me </a>
Notice theres a just a hash tag there, and usually causes the page to jump when clicked on, right? [I think]. It is only for interactive stuff, doesn't go to another page or anything else. I see a lot of developers do this.
I feel like its the wrong thing to do though. Is there another recommended way to do this without using HTML attributes a way where it is not suppose to be used?
Not using <button> ether because the link would not be a button.
Maybe without a hash?
<a class="trigger"> Click Me </a>
& in CSS:
.trigger {
cursor: pointer;
}
So the user still knows its for something that you should click?
I like to make such links return false on click, that way, clicking them doesn't result in any jumps.
With jQuery that would be as easy as
$(selector).click(function(e)
{
e.preventDefault();
});
or in the HTML as such
<a class="trigger" onclick="return false;" href=""> Click Me </a>
Don't remove that hash.
It's true that under (modern, at least) versions of Firefox, Chrome, Opera, and Safari, an anchor tag with an empty href (i.e. href="", not a missing href) will display as a normal link that simply doesn't respond when clicked, unlike the hash-href which jumps to the top of the page. Internet Explorer, however, takes a different approach.
When a link without an href is clicked in Internet Explorer, it responds by opening your Desktop directory in Windows Explorer. I got this response in IE7 and IE8 (IE6 just crashed, though that could be unrelated - I've had issues with that VM).
If a user browses your site in IE with JavaScript disabled, do you really want all your links to open their Desktop? I think not.
Also important is that removing the href attribute from an anchor element entirely causes it to be rendered as plain text - i.e. it doesn't act as a link, you can't tab to it, etc. Not good.
As for controlling the behaviour of the link when clicked, #partoa has the right, but possibly incomplete answer.
I'm no JavaScript guru by any stretch of the imagination,but from what I've read you don't want to use return false; for this. According to this article I came across a while ago, return false; has some additional behaviours you might not actually want. It recommends you just use preventDefault to stop the links normal behaviours (i.e. navigating to a new resource). Read over that link to see what return false; really does before deciding how you want to handle it.
For interactive purposes:
Removing the href="#" from your tag will also remove it from the default tab order, so users browsing with the keyboard will not be able to activate your link.
I recommend keeping href="#" in your tag and adding return false to the end of the script that is run by the link.
I can't see a reason why you would want to use an A tag for style purposes.
in konqueror (kde browser), you can disable pointers to change. Then your solution fails. But in general, I'm agree with you.