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">
Related
I can't find a question similar to mine or I don't know the exact keywords to search for. I'm trying to get a link to look like this:
https://localhost/Index#about
however, i'm not sure where to insert the #about in the url parameters.
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index">About</a>
If you're wondering, I'm using this piece of code for my navbar URLs. Thanks in advance!
Ok after searching the documentation of Microsoft:
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index" asp-fragment="about">About</a>
The asp-fragment attribute defines a URL fragment to append to the
URL. The Anchor Tag Helper adds the hash character (#).
Source: https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/anchor-tag-helper?view=aspnetcore-3.0
Try this:
<a asp-action="Index" asp-controller="Home" asp-route-id="#about">Index</a>
Found this from Here
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}}" />
I want to scrape a React website that has products with names and descriptions. The HTML structure looks like this:
<h6 class="menu-index-page__item-title" data-reactid=".5c2v.$menuItemContent.0">
<span data-reactid=".5c2v.$menuItemContent.0.1">Product name</span>
</h6>
<p class="menu-index-page__item-desc" data-reactid=".5c2v.$menuItemContent.1">
<span data-reactid=".5c2v.$menuItemContent.1.0">
<span data-reactid=".5c2v.$menuItemContent.1.0.0">
<span data-reactid=".5c2v.$menuItemContent.1.0.0.0:$0">Description line 1</span>
<br data-reactid=".5c2v.$menuItemContent.1.0.0.0:$0br">
<span data-reactid=".5c2v.$menuItemContent.1.0.0.$1">
<span data-reactid=".5c2v.$menuItemContent.1.0.0.$1.0">
<span data-reactid=".5c2v.$menuItemContent.1.0.0.$1.0.0">Description line 2</span>
<span data-reactid=".5c2v.$menuItemContent.1.0.0.$1.0.1">…</span>
</span>
</span>
</span>
</p>
If the description has more or fewer lines, the number of span tags will change, therefore making a XPath search invalid.
The only thing that comes back for each product on each page is:
.$menuItemContent.1.0.0.0:$0
for the first line of the description and
.$menuItemContent.1.0.0.$1.0.0
for the second line of the description.
Could I use a regular expression to grab just this part from the data-reactid attribute?
I am using Nokogiri at the moment.
The prices are more than likely dynamically loaded by a javascript once the webpage has finished displaying.
To be able to scrape dynamically loaded data, you will need to use a library like Watir which is supported by Rails 5.
With Watir, you are able to wait until all scripts are executed and all data is loaded before attempting to scrape the site.
So I have an app that I am trying to strip out all of the JQuery Mobile and now use Intel's App Framework. I am having trouble figuring out how to integrate multiple html pages into the app so that I don't have to have all my code in a single file. I tried this:
$.ui.loadContent("page2.html");
but that doesn't seem to work. I get a 'loading content' spinner but nothing seems to happen.
How do I link pages together from different files?
Ok so I have figured it out. The documentation can sometimes be hard to search and there is no search box available on their website right now. But if you go to the quickstart and then then AFUI(on the left) and then panel properties they say:
data-defer="filename.html" - This will load content into the panel
from a remote page/url. This is useful for separating out content into
different files. af.ui.ready is not available until all files are
loaded asynchronously.
So in my index.html file I have something like this:
<div id="afui">
<nav>
<ul class="list">
<li>Post a Lunch</li>
<li>Personal Profile</li>
<li>Select University</li>
</ul>
</nav>
<!--Main View Pages-->
<div class="panel" title="Events" id="event-list_panel" data-defer="event-list.html" data-load="loadMainEventsList"> </div>
<div class="panel" title="Description" id="description_panel" data-defer="description.html" data-load="loadEventDetails"> </div>
<div class="panel" title="Select University" id="select-university_panel" data-defer="select-university.html"> </div>
</div> <!--id="afui"-->
and then I have the details of each page in seperate files. In my mind this does a literal copy/paste, and I haven't found any evidences yet that it isn't just a copy/paste.
Update:
in AF3 data-defer is now data-include
I'm just starting using jquery mobile in a project. The problem I'm having is that every anchor tag I add, it sets its content to a fixed height value. I can't find a way to modify that behaviour.
An example of the code I'm using is:
<div data-role="content" data-theme="none" class="flex-container">
<div><strong>Something</strong></div>
<img src="../animg.png" alt="Icon" />A text
</div>
Does it only happens to me?
I think this depends where your link is. Is it in a listview?
I tried to make two links with two different images inside (different size) and I don't see the behaviour you are describing.
Also, even though probably unrelated, # in links is normally used to link to another page.
See here - http://jsfiddle.net/TeNCE/
Can you either provide your jsFiddle or edit this one?
<div data-role="page">
<div data-role="header">
<h1>Header</h1>
</div>
<div data-role="content" data-theme="none" class="flex-container">
<div><strong>Something</strong></div>
<img src="https://cdn1.iconfinder.com/data/icons/yooicons_set01_socialbookmarks/64/social_google_box.png" alt="Icon" />
<img src="https://cdn1.iconfinder.com/data/icons/yooicons_set01_socialbookmarks/128/social_google_box.png" alt="Icon" />
</div>
</div>