href

On-Click A-tag with Href, socket gets disconnected

China☆狼群 提交于 2019-12-12 09:49:35
问题 I am working on a project using socket.io. I want to give user some links to download a file as <a href="<path>" >Link Name</a> When I click on link to download file, my socket gets disconnected. When I use this <a href="<path>" target="_blank">Link Name</a> it works fine. Any reason why this happens? 回答1: When you follow a link within the same window, the current page's environment gets completely torn down, including the entire JavaScript environment in which your code (and socket.io's code

Editing all external links with javascript

强颜欢笑 提交于 2019-12-12 09:13:42
问题 How can I go through all external links in a div with javascript, adding (or appending) a class and alt-text? I guess I need to fetch all objects inside the div element, then check if each object is a , and check if the href attributen starts with http(s):// (should then be an external link), then add content to the alt and class attribute (if they don't exist create them, if they do exists; append the wanted values). But, how do I do this in code? 回答1: This one is tested: <style type="text

Href without http(s) prefix

倾然丶 夕夏残阳落幕 提交于 2019-12-12 08:18:40
问题 I just have created primitive html page. Here it is: example And here is its markup: <a href="www.google.com">www.google.com</a> <br/> <a href="http://www.google.com">http://www.google.com</a> 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/ .

using a href to call javascript function with parameter

允我心安 提交于 2019-12-12 06:38:35
问题 I'm trying to call javascript function from a href . the function has a parameter which will be retrieved by the eval function . But some error occurs . script: function rate(id) { // do something } the a tag that will call the function: <a href="javascript:rate(" + <%#Eval("ID")%> + ")" >rate</a> What am I missing ? 回答1: You shouldn't be doing it like this, but the issue you're currently up against is probably is your quoting/concatenating. If <%#Eval("ID")%> simply produces an INT, this

Split location.href for multiple values?

跟風遠走 提交于 2019-12-12 05:51:44
问题 I have a varient that finds the current url and splits it as follows: var ehref = window.location.href.split('?',1); This is then used to match the url with a navigation link href and give an ID to the page. My issue is that when our cookie pop up is closed, # is added to the url. Subsequently the page links are passed around between users with the # and the page ids do not work. What is a simple way of splitting the url at a # as well? I am new to jquery, thus I understand the gist of what I

jQuery - Identify and mark link in textarea

人走茶凉 提交于 2019-12-12 05:15:04
问题 I have a textarea <textarea id="postContent" class="input-block-level" placeholder="Tell us about it!" rows="4"></textarea> and I need a script that highlights the links written inside the textarea, stores them in a variable (array) for later processing and removes all html-tags. The behavior is well-know from the tweet-box on twitter. So the content could be Look what I have found today on www.stackoverflow.com! and in that case, www.stackoverflow.com should be highlighted (wrapped in a <p>

Wordpress navbar links using href=“#” not working as a dummy link

馋奶兔 提交于 2019-12-12 04:49:46
问题 I am using the free Wordpress theme Expositio (http://expositio.wpshower.com) and when I add a new link to the navbar with href="#", instead of being a dummy link, the system tries to load a new page going nowhere. I did this test with other templates and I did not find this problem. I want to use it in order to create a custom navbar with hidden submenus. Thanks!! 来源: https://stackoverflow.com/questions/45321624/wordpress-navbar-links-using-href-not-working-as-a-dummy-link

Browser opening text/xml in external program

孤者浪人 提交于 2019-12-12 04:47:59
问题 Is there a smart way to - from a browser - open hrefs to text files and XML files in an external program. My target platform is Win32 so preferably I'd have the files open in the default editor for it (as set in explorer.exe). The solution must work in Firefox. It's a bonus if it works in IE and Crome. My html is generated from a local developer database for files on disk. I.e. hrefs look like this: file://c:/a/b/c.ext . Currently, Firefox and IE show their built-in XML viewer, and god knows

When should href be used instead of routerLink in Angular?

时光毁灭记忆、已成空白 提交于 2019-12-12 03:24:27
问题 When I develop in Angular and create views, I always use the routerLink to navigate from one view to another. Recently I have seen important pages made in Angular that use href instead of routerLink to route views on the website. My question is, when is it convenient to use href instead of routerLink in Angular and why? Is it to give the feeling that it is not a SPA? If so, I do not understand it because it loses the full potential of Angular routing. Some examples are https://brandstory.in/

How does link with href parameter like “ymsgr:sendim?username” works, what kind of header does it send

你离开我真会死。 提交于 2019-12-12 02:55:44
问题 I want to make php script that replace the execution of this kind of a link: <a href="ymsgr:sendim?tonystark">YM! Iron Man</a> So when the php script is called/executed, it will open Yahoo Messenger application window that prepared to send IM to tonystark. Can I use header instead? but what type of header it would be? 回答1: The ymsgr is a custom protocol that is configured to start Yahoo Messenger, which is able to parse appropriate parameters following the " : ". This question ( how do I