a href link not work properly at local project - anchor

i have two href link to redirect page to new tab.
<a href="​http://www.sms.infisms.co.in/" target="_blank" >www.sms.infisms.co.in</a>
<br />
<a href="http://www.infisms.com" target="_blank" >www.infisms.com</a>
here first link redirect with this form http://localhost:3283/BulkSMSAdminProject/%E2%80%8Bhttp://www.sms.infisms.co.in/
what going wrong here..please help me..

Related

Thymeleaf: Get href without application context path

How to get URL without context path?
I am using spring boot 1.5.18.RELEASE and Thymeleaf
I tried this two possibilities.
<a th:href="#{${website}}" target="_blank"> Click here </a>
<a th:href="${website}" target="_blank"> Click here </a>
For example if the ${website} has the value www.example.com I get this result:
http://localhost:8081/MyApp/www.example.com
but I would like to get only this www.example.com without context Path.
I resolved it so:
<th:block th:with="link=${website}">
<a th:href="#{//{link}(link=${link})}" target="_blank">> Click here</a>
</th:block>
If you are linking to an external site, you should have http:// or https:// as part of the link -- https://www.example.com rather than just www.example.com. once you've added that, either of the two solutions in your initial post will work.
<a th:href="#{${website}}" target="_blank">Click here</a>
<a th:href="${website}" target="_blank">Click here</a>
// as you've indicated will work as well, but it's a bit silly. That just means that if your site is https:// it the link will be https:// (and vice versa for http://).
If you don't want to add https:// to your link, I would recommend something like this:
<a th:href="|https://${website}|" target="_blank">> Click here</a>
You can use dynamically, it works to me
<img th:src="${#httpServletRequest.scheme}+'://'+${#httpServletRequest.serverName}+':'+${#httpServletRequest.serverPort}+#{/user/display/${user.id}}" />

How to add an external link - Ruby on Rails

I am trying to link an external link to the code.
Currently I have the following:
<div class="col-md-4">
<div class="thumbnail">
<a href="www.google.com" target="_blank">
<img src="/assets/laptop.jpg" alt="Fjords" style="width:100%">
<div class="caption">
<p>How to set up emails</p>
</div>
</a>
</div>
</div>
I am getting an error telling me "No route matches [GET] "/www.google.com". However, I only want to click onto the picture and for the page to go to google.
You need to specify the protocol too (https:)
<a href="https://www.google.com" target="_blank">
Relative URL (URL with no protocol specified) are used to reference links on the same site. You need to use the Absolute URL (with protocol and other information like protocol, domain name) to refer to an external site.
Relative URL are used to reference links on the same site. You need to use the Absolute URL to refer to an external site.
You can reference external links without protocol by:
<a href="//www.google.com" target="_blank">
Or use:
<a href="https://www.google.com" target="_blank">

jquery mobile save button click event not firing

I am working on jQuery mobile controls. I have a jqgrid in a master page and on click of selected row id I am redirecting to another page with the id. In that page I have drop down which is bound with json. And after binding I want to save data to database on click of a button.
The problem is that the button click event is not firing, however, when I run that particular aspx on its own the button click event does fire.
<a href="#" data-role="button" data-inline="true" id="btnsave" data-transition="fade"
data-theme="b" data-icon="check" data-iconpos="right" runat="server"
onserverclick="btnsave_click" >Save</a>
Try adding the data-ajax="false" to your link.
For example
<a href="#" data-role="button" data-ajax="false" data-inline="true" id="btnsave"
data-transition="fade" data-theme="b" data-icon="check" data-iconpos="right"
runat="server" onserverclick="btnsave_click" >Save</a>
Now for the explanation, by default when you link to a page in jQuery Mobile, JQM pulls in that page via ajax and attaches it to the current page's DOM. When JQM pulls in a page via ajax it only pulls in that data-role="page" and does not load any of resources that may be in the <head> or elsewhere on the page.
From your question and markup it sounds like you are using asp.net, without seeing any more of your markup/code I'm pretty certain that your issue is that you don't have the necessary code for the linked page on your master page.
Normally to resolve this you can either place the unique content within the linked page's data=role="page" div, or when you call the page make sure the page is completely loaded, that is without ajax. In your case since it looks like you are trying to call a server method the code to create the postback is probably outside of your second page's div in which case you will need to load the page without ajax, the easiest way you can do that is by adding the data-ajax="false" to your link.

Twitter's share ignores my data-url and data-text

Whatever I set data-url or data-text to, twitter just fetches the URL of the page the sharing button exists in and shows as the tweet-text.
example :
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="http://www.gogole.com"
data-text="BLABLABLA" style="opacity:0">TWEET</a>
or
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="<?php echo
urlencode('http://www.gogole.com')?>" data-text="BLABLABLA" style="opacity:0">TWEET</a>
in both cases, clicking on the link opens a new window with the twitter sharing box that includes the URL of my website and ignores the attributes I set.
Something should have gone dangly wrong. help appreciated !
please tell me if you need more info to be posted.
Thanks,
/t
You can use the query parameter "url" with the twitter share link "https://twitter.com/share"
When looking for the URL twitter button follow this priority:
Look for url in the share link query string
If not found, look for the data-url attribute of the Tweet Button anchor tag
If not found, look for the rel="canonical" link tag in the head of the document
If not found use the URL of the webpage
I have faced same issue - when using link as described in manual's example it didnt work.
this NOT works:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share" data-text="my_title" data-url="my_url" data-hashtags="my_hash" data-via="my_name" data-related="my_name">Tweet</a>
but this WORKS:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share?text=my_text&url=my_url&hashtags=my_hash&via=my_name&related=my_name">Tweet</a>
Don't know why twitter ignores data- attributes, but when params are inside the link as GET params - everything works fine.
Hope this will be helpful for someone in future)
I fixed this by moving script widgets.js before button markup and turning off async mode, like this:
<script src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="H..." />
twitter-share-button class also important.

How to open an image in a new browser tab?

I'm trying to open an image in new brrowser tab like this:
<a href="" target="_blank">
<img height="660px" width="420px"
src="<%= Url.Action("WebPageImage", "WPMManagement", new { id = actualId }) %>"
alt="bild mit webseiten version" />
</a>
I need to show just an image and nothing else (no styles etc.)
What about href? What do I need in it?
Change the href attribute to the URL of your image and you're good to go:
Click here to view the image
EDIT: If you're retrieving images from the database, then you'll need Url.Action rather than Url.Content. Check out this question for a similar discussion about retrieving images from a database.
EDIT #2: Updated the example code to use Url.Action rather than Url.Content

Resources