milk-smartlinkdeprecated

smart link

Usage no npm install needed!

<script type="module">
  import milkSmartlink from 'https://cdn.skypack.dev/milk-smartlink';
</script>

README

🍼 milk

NPM

!important;

this package is under construction!

feedback? write me 📬

why

redirect to different url if I visit a page from a different OS, for example it can be useful if we are talking about app download link: why add different buttons with DOWNLOAD FROM PLAY STORE and DOWNLOAD FROM APP STORE if I am using an iPhone? Maybe I can only visit a link that will redirect me to App Store. With 🍼 milk you can easly do this!

how

just type milk [--android={url}] [--ios={url}] [--windows={url}] ... to generate a JS or an HTML file that will redirect to correct page if it will be executed on different platforms, go in the next section for the details

commands and parameters

milk

--android={url} redirects the user to the url if he/she is using an Android device 📲

--ios={url} redirects the user to the url if he/she is using an iOS device 📲

--windows={url} redirects the user to the url if he/she is using Windows 💻

--mac={url} redirects the user to the url if he/she is using OS X / mac OS 💻

--linux={url} redirects the user to the url if he/she is using Linux 💻

--web={url} redirects the user in all the other cases or if some parameters are not explicitly added 💻

(...at least one platform must be added as a milk parameter!)

--html to generate an m.html file with the logic of milk already in a <script></script>, you can upload directly this HTML to redirect the user

--js to generate a m.js file with milk logic (default if no output parameters are specified)

--u to uglify the JS with uglify-js, works both in HTML and JS

example

if we want to generate a webpage that redirect to App Store if we are on iOS and Play Store if we are on Android of the app Instagram, then we just have to call milk --android=https://play.google.com/store/apps/details?id=com.instagram.android --ios=https://itunes.apple.com/app/instagram/id389801252 and the output will be a m.js file that we can embed in any HTML with <script></script> tag and if a user visits this page will be redirected to the correct Store, or maybe we can can call milk --android=https://play.google.com/store/apps/details?id=com.instagram.android --ios=https://itunes.apple.com/app/instagram/id389801252 --html in order to generate a m.html file that will make the redirection to the correct store

...more complete examples will arrive soon! 😊

milk.matteomanzinello.com

🍼