Can we implement copy to clipboard in AMP stories? - amp-story

AMP stories is a good way to show content. Some of the elements available in AMP are very cool. Can we implement copy to clipboard in AMP stories?
For example, I want to show the user a text like Copy this coupon and apply. And when the user presses that text, the coupon is copied.
Is it possible?

This is currently not possible in AMP stories. You can file it as a feature request on GitHub

Related

Download PDF in React

I'm working on an api which returns a PDF link. I can put that link into a button, and when users click on that link, it'll download a PDF to their computer. I wonder if there is a way, so that when users click on the link the first time, it'll download the file. But if they click on the link the second time, it just opens a modal with the PDF content inside of it? That way they don't have to download the file again and again.
It's confidential so I can't tell how the link look like, but it's a PDF link stored in s3 aws.
You can do it but you need to store the information that if the user clicked the button before or not. The options for storing that information is:
Local Storage
Cookie
Your backend
I would suggest not to involve your backend on this, you can just write to localStorage when user clicks that link for the first time and set something like pdfDownloadedPreviously. If you have multiple pdfs like this, you would need to define a unique key for each of them so they don't override each other.
And in your program logic, you can read this from the localStorage, if that key exists in the localStorage then you open your modal, otherwise download.

How do you automatically add text dynamically to an image an export it?

Recently, Spotify released their 2019 Spotify wrapped web application, which is essentially a way for both music artists and music listeners to rewind and review what they listened to/who listened to their music in the past year.
As part of their site, they dynamically created these images that people could either export or share to one of their social media networks.
Above is an example of one of those dynamically generated images (of course, the image, and the text/statistics below change).
How would I go about doing this in code?
Sorry if this is in the wrong place - just wasn't sure where I would post this. Thanks in advance!
The easiest way of doing this would be to use a SVG as your base template allowing you to add in the text values after the fact.
Add the SVG to a canvas which can then be converted to jpeg by using .toDataURL("image/jpeg")

save html page in pdf format in angularJS

I want to have a save page button on my site to allow users to just download the page that they are on.
is there like an ng-save that i can use or something?
As you've tagged PDF, I'm assuming that you're looking to save the page in a PDF format. If so, you might want to take a look at PhantomJS, which has an option to save as PDF:
http://phantomjs.org/screen-capture.html

download file which redirects?

I've tried to search for this both on Google and StackOverFlow, but simply can't find what I'm looking for, it might be that it's simply not possible, but thought I would ask anyway.
I'm looking for a way to make a file redirect the user to another page, the user would download the file by clicking on a button.
It's for a Prestashop downloadable product, I'm trying to redirect the user to another part of our site (which isn't directly visible) to be able to view magazines, etc. in a viewer.
Now Prestashop is natively set up to download the file, which is what we don't want, hence the use of the viewer, but there is no way to simply provide a link to send the user to instead of a physical file, like a PDF or something. I can't really modify the button as its generated by Prestashop, and if I add a PDF file with the link in there it defeats te purpose as I dont want people having the link in a document (I know they can find it from their history and so on). Hence I thought it would be easier to do it with a document that redirects if possible.
So in short, is it possible to make a file that would send people to a certain web page once they open/download this file on/to their computer?
And if yes, how would one go about it?
Can you make the user download an HTML file? If so, you can use "meta refresh" to redirect the user to your private page.
This does mean the unprotected link will be visible in downloaded HTML file - perhaps you can obfuscate this with JavaScript to make it a little more difficult for users to find your protected URL.
http://www.w3.org/TR/WCAG20-TECHS/H76

How do I tackle ordered text widget on multiple pages in cakephp

Hey guys. so I'm not quite sure how to tackle my next big problem in this project.
I want to create an admin interface which allows my client to create a dynamic menu page for the food and drinks. Basically, I want him to be able to enter a short paragraph for the top of the page, and then 2-6 widgets that he can drag and drop onto the page. This menu will then render under owlhouse.com.au/food. I figure it'll be something to do with associations, but I have no idea how to construct a function which attaches dynamic data to the page on the fly.. and keep it in the layout the client wants (2 columns, diff modules for beer, wine, etc.)
HOW ON EARTH DO I GO ABOUT THIS?
thankyou,
~Harley
Dynamic Data
Build a "CRUD" interface that the client can log into. (Think blog entries). Store the content in the database (of course). Then provide a drag & drop interface that allows the client to order them, assign them to pages, or whatever is needed to meet the requirement. When the client clicks update, you simply add/remove IDs to the content for the given page. When the page loads (like a blog page) it loads the content for the given IDs.
Widgets
The same would apply for widgets. I would build an element that provides the basic layout for the widget. Then build it the same way as the content. The client will have CRUD functionality with drag & drop interface to show which widgets are displayed.
Send me a PM if you need to hire someone. ;)

Resources