EzDevInfo.com

hyperlink interview questions

Top hyperlink frequently asked interview questions

How do I programmatically click a link with javascript?

Hello is there any way to programmatically click on a link on my page using javascript?


Source: (StackOverflow)

Can Google Chrome open local links?

I am linking on an intranet page to a local file on a shared drive:

<a rel='nofollow' href="file:///s:/test.xls"> Test</a>

This works in IE and Firefox with an addon called local link.

How can i get this to open in google chrome?

Thanks


Source: (StackOverflow)

Advertisements

How can I set the text of a WPF Hyperlink via data binding?

In WPF, I want to create a hyperlink that navigates to the details of an object, and I want the text of the hyperlink to be the name of the object. Right now, I have this:

<TextBlock><Hyperlink Command="local:MyCommands.ViewDetails" CommandParameter="{Binding}">Object Name</Hyperlink></TextBlock>

But I want "Object Name" to be bound to the actual name of the object. I would like to do something like this:

<TextBlock><Hyperlink Command="local:MyCommands.ViewDetails" CommandParameter="{Binding}" Text="{Binding Path=Name}"/></TextBlock>

However, the Hyperlink class does not have a text or content property that is suitable for data binding (that is, a dependency property).

Any ideas?


Source: (StackOverflow)

How can I get clickable hyperlinks in AlertDialog from a string resource?

What I am trying to accomplish is to have clickable hyperlinks in the message text displayed by an AlertDialog. While the AlertDialog implementation happily underlines and colors any hyperlinks (defined using <a rel='nofollow' href="..."> in the string resource passed to Builder.setMessage) supplied the links do not become clickable.

The code I am currently using looks like this:

new AlertDialog.Builder(MainActivity.this).setTitle(
        R.string.Title_About).setMessage(
        getResources().getText(R.string.about))
        .setPositiveButton(android.R.string.ok, null)
        .setIcon(R.drawable.icon).show();

I'd like to avoid using a WebView to just display a text snippet, so any advice how to get this working is much appreciated!


Source: (StackOverflow)

How to make an HTML back link?

What is the simplest way to create an <a> tag that links to the previous web page? Basically a simulated back button, but an actual hyperlink. Client-side technologies only, please.

Edit
Looking for solutions that have the benefit of showing the URL of the page you're about to click on when hovering, like a normal, static hyperlink. I'd rather not have the user looking at history.go(-1) when hovering on a hyperlink. Best I've found so far is:

<script>
  document.write('<a rel='nofollow' href="' + document.referrer + '">Go Back</a>');
</script>

Is document.referrer reliable? Cross-browser safe? I'll be happy to accept a better answer.


Source: (StackOverflow)

Need to remove href values when printing in Chrome

I'm attempting to customize the print CSS, and finding that it prints links out with the href value as well as the link.

This is in Chrome.

For this HTML:

<a rel='nofollow' href="http://www.google.com">Google</a>

It prints:

Google (http://www.google.com)

And I want it to print:

Google

Source: (StackOverflow)

How to convert an address into a Google Maps Link (NOT MAP)

After looking (Googling) on the web for a while I can find nothing that takes a address like:

1200 Pennsylvania Ave SE, Washington, District of Columbia, 20003

and converts it into a clickable link:

http://maps.google.com/maps?f=q&source=s_q&hl=en&q=1200+Pennsylvania+Ave+SE,+Washington,+District+of+Columbia,+20003&sll=37.0625,-95.677068&sspn=44.118686,114.169922&ie=UTF8&cd=1&geocode=FT5MUQIdIDlp-w&split=0&ll=38.882147,-76.99017&spn=0.01064,0.027874&z=16&iwloc=A

jQuery or PHP preferred or just any useful information on this.


Source: (StackOverflow)

Javascript REGEX: How to get youtube video id from URL?

I want to get the v=id from youtube's URL with javascript(no jquery, pure javascript);

Example Youtube URL formats:


http://www.youtube.com/watch?v=u8nQa1cJyX8&a=GxdCwVVULXctT2lYDEPllDR0LRTutYfW

http://www.youtube.com/watch?v=u8nQa1cJyX8

or any other youtube format what contains a video id in the url

Result from these formats


u8nQa1cJyX8


Source: (StackOverflow)

What is href="#" and why is it used?

On many websites I see links that have rel='nofollow' href="#". What does it mean? What is it used for?


Source: (StackOverflow)

JQuery smooth scrolling when clicking an anchor link

I have a couple of hyperlinks on my page. A FAQ that users will read when they visit my help section.

Using Anchor links, I can make the page scroll towards the anchor and guide the users there.

Is there a way to make that scrolling smooth?

Something like this: http://www.position-relative.net/creation/anchor/

But notice that he's using a custom javascript lib. Maybe jQuery offers somethings like this baked in?


Source: (StackOverflow)

markdown target="_blank"

Is there a way to create a link in markdown that opens in a new window? If not, what syntax do you recommend to do this. I'll add it to the markdown compiler I use. I think it should be an option.


Source: (StackOverflow)

How to close current tab in a browser window?

I want to create a link on a webpage that would close current active tab in a browser without closing other tabs in the browser. When user clicks close link, an alert message should appear asking user to confirm with two buttons, "YES" and "NO". If user clicks "YES", close that page and If "NO", do nothing.

How can it be done? Any suggestions?


Source: (StackOverflow)

Remove stubborn underline from link

I am attempting to have a link show up in white, without an underline. The text color shows up correctly as white, but the blue underline is stubbornly persisting. I tried text-decoration: none; and text-decoration: none !important; in the CSS to remove the link underline. Neither worked.

The HTML:

<div class="boxhead">
    <h2>
        <span class="thisPage">Current Page</span>
        <a rel='nofollow' href="myLink"><span class="otherPage">Different Page</span></a>
    </h2>
</div>

The CSS:

.boxhead .otherPage {
    color: #FFFFFF;
    text-decoration: none;
}

How can I remove the blue underline from the link?


Source: (StackOverflow)

How do I make links in a TextView clickable?

I have the following TextView defined:

<TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="@string/txtCredits"
    android:autoLink="web" android:id="@+id/infoTxtCredits"
    android:layout_centerInParent="true"
    android:linksClickable="true"></TextView>

where @string/txtCredits is a string resource that contains <a rel='nofollow' href="some site">Link text</a>.

Android is highlighting the links in the TextView, but they do not respond to clicks. Can someone tell me what I'm doing wrong? Do I have to set an onClickListener for the TextView in my activity for something as simple as this?

Looks like it has to do with the way I define my string resource. This does not work:

<string name="txtCredits"><a rel='nofollow' href="http://www.google.com">Google</a></string>

But this does:

<string name="txtCredits">www.google.com</string>

Which is a bummer because I would much rather show a text link than show the full URL.


Source: (StackOverflow)

How to create an HTML button that acts like a link?

I would like to create an HTML button that acts like a link. So, when you click the button, it redirects to a page. I would like it to be as accessible as possible.

I would also like it so there aren't any extra characters, or parameters in the URL.

How can I achieve this?

I am currently doing this:

<form method="get" action="/page2">
    <button type="submit">Continue</button>
</form>

but the problem with this is that in Safari and Internet Explorer, it adds a question mark character to the end of the URL. I need to find a solution that doesn't add any characters to the end of the URL.

There are two other solutions to this: using JavaScript or styling a link to look like a button.

Using JavaScript:

<button onclick="window.location.rel='nofollow' href='/page2'">Continue</button>

But this obviously requires JavaScript, and for that reason it is less accessible to screen readers. The point of a link is to go to another page. So trying to make a button act like a link is the wrong solution. My suggestion is that you should use a link and style it to look like a button.

<a rel='nofollow' href="/page2>Continue</a>

Source: (StackOverflow)