inapp-share-kit
v1.0.2
Published
A lightweight widget that detects LinkedIn's in-app browser and surfaces a Copy link button — so your readers can actually share the page they're currently on.
Maintainers
Readme
inapp-share-kit
A lightweight JavaScript widget that detects LinkedIn's in-app browser and injects a floating "Copy link" button — so your readers can share the current page URL, not the original feed link.
The Problem
When someone opens a link from LinkedIn, it loads inside LinkedIn's in-app browser. That browser has its own navigation bar with a built-in "Copy link" button.
The issue: that button always copies the original URL shared in the feed — not the URL of the page the user has navigated to.
Example:
- A LinkedIn post links to your homepage.
- The user clicks it and navigates to a blog post or product page.
- Clicking LinkedIn's nav bar "Copy link" button still copies your homepage URL, not the blog/product page URL.
This is a known, unfixed behaviour in LinkedIn's in-app browser. There is no way to modify the browser’s built-in nav bar from your site.
How inapp-share-kit Solves It
inapp-share-kit injects a floating copy button directly into your page:
- Copies the current page URL (
window.location.href) instead of the feed URL. - Only appears when the page is opened inside LinkedIn's in-app browser, so it doesn’t interfere with regular visitors.
- Fully customizable position (
leftorright) and includes built-in modern styling. - Lightweight and dependency-free.
Installation
npm install inapp-share-kitOr include directly in your HTML:
<script src="path/to/inapp-share-kit/index.js"></script>Usage
<script>
InAppShareKit.init({
position: "left", // "left" or "right"
showOnlyLinkedIn: true, // only show inside LinkedIn in-app browser
debug: true // logs info in console
});
</script>The button will automatically appear in your site when opened in LinkedIn's in-app browser, letting users copy the real current URL of the page.
License
MIT
