Search code examples
javascriptiisurl-rewritinglinkedin-api

Linkedin ShareArticle. Wrong URL


When I share a job in linkedIn, the Posted job takes me to some other link and not the provided one. However, when I replace it with some fb.com, it works fine.

provided URL is the same as window.location.href

$scope.shareOnIN = function (job) {
            var description = job.details.replace(/<[^>]+>/g, ''); //remove html tags
            description = description.substring(0, description.length > 150 ? 150 : description.length); //take max 150 chracters

            var windim = {
                width: 500,
                height: 500
            };
            windim.top = parseInt((screen.availHeight / 2) - (windim.height / 2));
            windim.left = parseInt((screen.availWidth / 2) - (windim.width / 2));
            windim.screenX = windim.left;
            windim.screenY = windim.top;
            windim = $.param(windim).replace(/&/g, ',');
            var url = 'https://www.linkedin.com/shareArticle?mini=true&url=https://day-job.dk/job-detaljer/kundeservice-customer-service-medarbejder-med-energi-og-overblik-3062/';
            window.open( url, '_blank', windim);
            return false;
        }

it takes me to

 https://day-job.dk/job-detaljer/?kundeservice-customer-service-medarbejder-med-energi&amp;og-overblik&amp;3062/

this scheme was provided in ISS URL rewriting but I modified it but it didn't any effect. Commenting the rules just made it unstable


Solution

  • The problem was perhaps due to linked Cache on LinkedIn server.

    I was unable to find the solution even with the help of many experts. After appending any number at the end of URL, it started to open URL residing in tag in the head of the page.

    Fortunately, adding number doesn't affect the working of the page so it worked for me