Add hyperlink within reality composer that can be used on WEB AR - augmented-reality

So Im wondering is there anyway you can add a hyperlink action in reality composer that can be used in web ar?
I can't seem to find an action for this?
The way I'm using the reality file on my website is like so
<a href="<...link to .reality file>" rel="ar">
<img />
</a>
any help would be appreciated?

In short, the link is:
<a rel="ar" id="CustomAction" href="kids‑slide.usdz#callToAction=Browse%20API&checkoutTitle=Kids%20Slide&checkoutSubtitle=Playground%20in%20your%20backyard&price=$145"> <img src="kids-slide-thumbnail.png"> </a>
Look at sections: "Display a Custom Banner" and "Detect a Tap" for detection of the tab. It isn't configured in Reality Composer but rather in the link it self: https://developer.apple.com/documentation/arkit/adding_an_apple_pay_button_or_a_custom_action_in_ar_quick_look

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}}" />

Capybara: click on text within <span>

I had a bot that would apply on indeed.com jobs. It would collect jobs then apply to them one by one. However, indeed recently made things a lot harder. Used to be able to just locate the button's id and use that but now the id is dynamic: changes from different job positions.
Does anyone know how it is possible to link to the "Apply Now" button (not really a botton) if the code below is:
<a class="indeed-apply-button" href="javascript:void(0);" id="indeed-ia-1532137767182-0">
<span class="indeed-apply-button-inner" id="indeed-ia-1532137767182-0inner">
<span class="indeed-apply-button-label" id="indeed-ia-1532137767182-0label">Apply Now</span>
<span class="indeed-apply-button-cm">
<img src="https://d3fw5vlhllyvee.cloudfront.net/indeedapply/s/14096d1/check.png" style="border: 0px;">
</span>
</span>
</a>
Many ways to click that element, the 3 simplest would probably be
click_link('Apply Now') # find link by partial text and click it
click_link(class: 'indeed-apply-button') # find and click link by class
find('span', text: 'Apply Now').click # find span by text and click in it
in my case I had to select an option shown using js-chosen library inside an iframe. So, its not a regular select tag. So had to do following to select:-
within_frame(find("#cci_form")) do
find('#showing_listing_id_chosen').click
find('[data-option-array-index="2"]').click
end
But, no luck using
find('.active-result[data-option-array-index="2"]').click
or
find('li[data-option-array-index="2"]').click

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

How to have multiple links from one image in rails

I have one image from which I have to have 7 different links based on the part of the image clicked. How do I go about it using rails?
For future reference, you're talking about "image maps" - there's various tutorials for these, eg
http://www.onextrapixel.com/2009/04/30/how-to-create-multiple-links-on-a-single-image-with-image-map/
As far as i know this isn't really a rails question, as image maps are a totally front-end thing: like js, they only relate to the page as seen in the browser. As far as rails is concerned, when you click on a link it doesn't care whether that link was on an image map or not.
So, it's just some raw html that you would put in your view template.
I suppose you could make the image maps data-driven though, so that for example you store an image filename in the db and then save any map data in the db too, in an image_maps table. It's only worth doing this if you want to make the image maps user-editable, like flicker does for example. (flickr lets you draw a rectangle on an existing photo and tag it with some text)
just use url_for to generate the needed url
<img usemap="image_link" src="..." alt="" width="235" height="32" style="display: block;" />
<map name="image_link">
<area href="<%= url_for root_path %>" alt="Home" coords="0,0,189,19" shape="rect" />
<area href="<%= url_for :controller => "post", :action => "all" %>" alt="All posts" coords="190,0,386,22" shape="rect" />
<area href="<%= url_for new_resource1_path %>" alt="New resource1" coords="387,0,657,23" shape="rect" />
</map>
the root_path is defined as the home page and resource1 as a resource in config/routes.rb.
This is more of a javascript/flash type thing. You can absolutely position divs with links if you know exactly where the links need to go and you are not looking for an area for the user to click because this will just generate a link with text in a specific position.
Sounds to mee like you will need to make a flash app or do javascript workaround. This is not a Rails type issue so your solution won't come from Ruby/Rails.

Resources