Creating Dynamic FTP Link in JqGrid Column - javascript

I'm creating a dynamic link on the last "column" of the jqGrid,and I'm putting an a tag inside this column,the value of "href" must be a link which is coming from my action and is an ftp address.
The problem is that despite the correct value of href,clicking the link navigates the user to the wrong url which is starting with "http"!!!
I wanna remove this extra "http"!!!
Here is the code to
'<a id="file" href="//' + rowobject.GeneratedFilePath + '" title="download"><div class="icon-details fa fa-external-link" style="display:inline-block"></div></a><span> </span>';
and here is the generated link <a> in runtime:
<a title="download" href="//ftp.test.com/Stat_On_150125_Daily.csv" id="file"><div style="display:inline-block" class="icon-details fa fa-external-link"></div></a>
and by clicking the link I'll be navigated to the following url:
http://ftp.test.com/Stat_On_150125_Daily.csv

The solution was really easy!!
I've found it,I have to add ftp:// in the beginning of href value
That's it.
<a title="download" href="ftp://ftp.test.com/Stat_On_150125_Daily.csv" id="file"><div style="display:inline-block" class="icon-details fa fa-external-link"></div></a>
Thanks a lot

Related

href # is not appending to end of URL

href # is not appending to end of URL
I have written the html page on which one of the anchor tag has href "#". Whenever I am clicking on it, # is not appending at the end of URL path in browser. Same functionality is working in different websites. Please suggest..
<li class="nav-item d-md-down-none">
<a class="nav-link" href="#">
<i class="icon-location-pin"></i>
</a>
</li>
My current url is "http://localhost:8080/add/AddDocument.html"
After clicking on the link i should get "http://localhost:8080/add/AddDocument.html#"
But i am getting this "http://localhost:8080/add/#"
This issue is solved.
There is <base href=”/”> tag present in my html which was loading alternative html link while clicking on href="#".
Thanks for all your help.
Usually, it is to link to part of a page ('#about'). If it is just there instead of being empty('#' vs. ''), it prevents the page from being reloaded on click.
Normally, you define it like this:
<div id="about"></a>
In order for your href to have a clickable link ie a web address, by placing the hashtag symbol, you refer the element (image,text, video etc) as a href if the website link is either not yet available or if it’s in the same page you can use the hashtag followed by the id name.
Also please check your routing.

Link to another page with anchor div id

So I have a number of dropdown links on my main navigation that need to link to other landing pages and scroll or show specific part of that page, like an article or a specific service. I have went through a lot of examples here but can't get this to work:
<a class="dropdown-item" href="#" onclick="location.href = '/voice-data#broadband/'">BROADBAND & MANAGED INTERNET</a>
The above link should anchor to this div on another page:
<div class="row broadband-block" id="#broadband">
At the moment it lands on the page it needs but doesn't go to the anchor div that it's supposed to,but it does add #broadband to the url in the browser. What am I doing wrong and what would be the best solution, as I have quite a few links like that to do?
Your problem is the ID attribute. Remove the # from your ID and it should fix your problem:
<div class="row broadband-block" id="#broadband">
<div class="row broadband-block" id="broadband">
Or adjust your 'a' tag and add an extra '#' to the front of your url:
<a class="dropdown-item" href="#" onclick="location.href = '/voice-data##broadband/'">BROADBAND & MANAGED INTERNET</a>
Also, javascript onclick not needed unless this is what your application environment requires, it can all be done inside href attribute.
you should do this
<a class="dropdown-item" href="/voice-data/#broadband">BROADBAND & MANAGED INTERNET</a>
just use the href instead of onclick.
and the ids should match, at the current state you should be using ##broadband
while you should use the id as follows:
<div class="row broadband-block" id="broadband">
Edit: #pointy pointed it out (no pun intended)

Making a hyperlink for Angularjs

I am working on a mobile site. I have created a hyperlink that works and was written in basic javascript.
'Go to Tour info '
This code works fine. But I wanted to change the code too better work with angularjs. I tried rewriting it just as...
'<a ng-href="/tours/'+$scope.tourmarkers[i]._id+'">Go to Tour info </a>'
where i cut off part of the of the url that was already being used. I changed the href by adding the ng in front. But I do not feel this is an angular statement. How can i make my original hyperlink be written for angularjs??
try this:
<a ng-href="{{'/tours/' + $scope.tourmarkers[i]._id}}">Go to Tour info </a>
try this
<a ng-href="/tours/{{$scope.tourmarkers[i]._id}}">Go to Tour info </a>
OR
in your controller
$scope.path = '/tours/' + $scope.tourmarkers[i]._id
now in view
'<a ng-href="{{path}}">Go to Tour info </a>'
since ng-href binds dynamically

Writing html tag instead of "text" in javascript file

I am using the bxslider carousel that generates a slider, as part of the settings I have:
...
nextText:"Next",
prevText:"Prev",
...
So the next button in the slider has the text "Next" (and same thing for the previous button). But instead of the text, I want to add a span with an image. How can I change that so it displays something like <span class="glyphicon glyphicon-search"></span> instead of "Next" or "Prev" text?
Thanks in advance
The website link
I have solved the problem by means of this link. I am sorry for this weak question. I have added like that;
nextText: '<span class="glyphicon glyphicon-search"></span>'
If you want to add the tag to an existing HTML tag, such as a div with id myDiv:
getElementById('myDiv').innerHTML = '<span class="glyphicon glyphicon-search"></span>';
or
getElementById('myDiv').appendChild('<span class="glyphicon glyphicon-search"></span>');

How to make this JS link work?

I want to put a site link in my site and I don't want to show it in the status bar, so I used this code below but it's not clickable.
<a rel"nofollow" href="javascript:;" onclick="location.href='http://sitelink">text</a>
And, is the rel"nofollow" work with this code?
Try:
<a rel="nofollow" href="#" onclick="location.href='http://sitelink'">text</a>
rel is an attribute so use an =
use # in the href so that the link does target the current page
in the onclick you have a mess with the quotes, you forgot the closing '
But instead of misusing an a tag you could also use a button or span for your purpose:
<button onclick="location.href='http://sitelink'">text</button>
Try this:
<a rel="nofollow" href="Javascript:void(0)" onclick="window.location='http://sitelink'">text</a>

Categories

Resources