anchor

.htaccess redirect anchor page/page#anchor to url

谁说胖子不能爱 提交于 2019-12-02 14:29:23
问题 How do I redirect page/page#anchor to http://www.example.com/page/page . I tried the following code, but it's not working RewriteRule ^page/page#anchor http://www.example.com/page/page [NE,L] Could you please help me? Peter 回答1: That can't be done on server side since URI component after # is handled by client side only. You can alternatively use this Javascript code to do the same: <script> if (location.href.indexOf("#") > -1) { location.assign(location.href.replace(/(page\/page)#anchor/i, "

CSS: Styling a link based on its href

好久不见. 提交于 2019-12-02 13:00:32
I have a 3rd party link on my website which I want to style. but it don't have any class or id which I can target. Only thing it have is its unique href value. Is it possible to style a anchor tag based on its href value. Vitorino fernandes You can use href css selector to style a tag based on link: a[href="your url here"]{ background:red; } Demo Owais Ahmed You can use css attribute selector like: a[href="http://google.com"]{ your css code here ... } More information here . Thanks. 来源: https://stackoverflow.com/questions/29331831/css-styling-a-link-based-on-its-href

jquery .click overriding anchor href when i dont want it to!

心已入冬 提交于 2019-12-02 11:01:43
I have a set of nested DIVs that slidetoggle using jQuery as the user clicks on them. Inside the innermost DIV there is an anchor tag with an HREF that should navigate somewhere. The problem is that when I click on the link it slidetoggles just like the parent DIVs instead of navigating to the url. If I right click the anchor and select open in new tab then that navigates fine. Please can you spot whats going wrong? Thanks <div class="pod"> <li id='ThirdParty'> <div class='block'> <h1>ThirdParty</h1> <div class='systemHeader'> <h2><span>Bobs shop</span></h2> <div class='subSystems'> <div class

Anchor tags href isn't working when iframe is opened in a react dialog model

こ雲淡風輕ζ 提交于 2019-12-02 10:16:16
We have opened an iframe in model dialog. In the iframe we are loading a document . The document is also and html page. The <a> tags in the document are not navigating to the id mentioned in their href . Just a sample from the html document. Below is the <a> example, <a data-custom-class="link" href="#infoshare"> 2. WILL YOUR INFORMATION BE SHARED WITH ANYONE? </a> <p id="infoshare" style="font-size:15px;"> <span style="color: rgb(0, 0, 0);"> <strong> <span style="font-size: 19px;"> <span data-custom-class="heading_1"> 2. WILL YOUR INFORMATION BE SHARED WITH ANYONE? </span> </span>  </strong> 

How to hide anchor tag from URL

懵懂的女人 提交于 2019-12-02 09:50:06
How can I hide the hash value from the following link href in the address bar? <a href="index.php#dev_name"> So it'll redirect me to a the index.php#dev_name , but I want the address bar to only show index.php You can use a Javascript onclick event. The browser will still show index.php , but the onclick event will trigger first, and redirect the browser to the right page. <a href="index.php" onclick="location.redirect('index.php#dev');"> 来源: https://stackoverflow.com/questions/10045303/how-to-hide-anchor-tag-from-url

How to extract the text between anchor tag in PHP?

不羁的心 提交于 2019-12-02 09:39:54
I've one string in a variable titled $message as follows : $message = 'posted an event in <a href="http://52.1.47.143/group/186/">TEST PRA</a>'; I only want to get the text within anchor tag i.e. TEST PRA in this case using PHP. How should I do this in an efficient way? Can someone please help me in this regard? Thanks in advance. Use preg_match_all function inorder to do a global match. preg_match_all('~>\K[^<>]*(?=<)~', $str, $match); Here preg_match would be enough. \K discards the previously matched characters from printing at the final, so it won't consider the previouslly matched >

Redirecting old anchor links to new anchor links

别来无恙 提交于 2019-12-02 09:16:04
问题 I'm overhauling a website that someone else built for my organization. It was originally set up with "not so great" anchor links which included spaces. I have replaced those anchors with new ones that will work better. Example: One of the old anchors looked like this /course/#To Have which browsers would luckily convert to /course/#To%20Have . I changed that anchor to this: /course/#to-have . I'm now wanting to make sure that any anchors that may have been shared on social media or that could

Updating keyboard focus when implementing the skip to main content technique through an anchor link

本小妞迷上赌 提交于 2019-12-02 08:46:18
问题 I'm implementing the skip to main content technique described in W3C's WCAG2.0 Techniques documentation, however I'm struggling to update the keyboard focus when activating the link. (Note that I'm testing this on the latest public version of Chrome). Firstly, here is my JavaScript function: function skipToMainContent() { var hash = window.location.hash.substring(1); if (hash === "main") { var el = document.getElementById(hash); el.tabIndex = 0; el.focus(); } } skipToMainContent(); What this

header Location redirect with anchor tag and IE7

核能气质少年 提交于 2019-12-02 08:45:01
Hey there! Here is my issue, it could just be a browser issue but any help/ideas would be awesome! Pretty much I have the following redirect: header("Location: page.php#images"); In most modern browsers it will redirect to page.php#images without any problems but in IE it seems to strip the #images. Has anyone come across this? So far my only option (which I think is a terrible option) is to redirect through JavaScript. thanks! UPDATE I sent up a simple sandbox and it seems to work fine with or without an absolute URL. I guess there is something else going on in my actual app that is

How to select a span with multiple classes and placed inside an anchor?

十年热恋 提交于 2019-12-02 08:07:04
I'm in a situation where I need to bind a click event to a span (placed inside an achor having multiple classes) based on the classes applied to it. For eg: UPDATE: Added the html eg below <div class="c0 c"> <a class="c1 c2"> <span class="c3 c4"></span>Anchor_Text </a> </div> Now I'm binding a click event as below: $('span.c3.c4').click(function (e) { alert("clicked!"); }); The above jQuery code doesnt work. However if I use the classes on anchor to bind the click event, it works. Please see below: $(.c1').click(function (e) { alert("clicked!"); }); $(.c2').click(function (e) { alert("clicked!