Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmarklet does not work, only opens create/manage page #3601

Open
codydunne opened this issue Sep 17, 2024 · 5 comments
Open

Bookmarklet does not work, only opens create/manage page #3601

codydunne opened this issue Sep 17, 2024 · 5 comments

Comments

@codydunne
Copy link

The bookmarklet listed at https://perma.cc/settings/tools does not work for me. It only opens a new tab, gives it focus, and redirects to https://perma.cc/manage/create without creating a perma link.

This is the code I see for the bookmarklet:

window.open('https://perma.cc/service/bookmarklet-create/?v=1&url='+encodeURIComponent(location.href));window.focus();

I've tried using the bookmarklet in the latest Firefox and Edge on Windows 11.

@rebeccacremona
Copy link
Contributor

Hello Cody!

You may prefer to use our full-featured browser extension: https://chromewebstore.google.com/detail/permacc/bigjakhahgnccheaompmgebkncglllel?pli=1

The bookmarklet (which was written a long time ago), indeed, has only very limited functionality. It does not automatically trigger the creation of a Perma Link. It should, in fact, open a new tab, give it focus, and redirect to https://perma.cc/manage/create ..... but, the URL should be auto-populated into the form for you, so all you have to do is click the create button.

@codydunne
Copy link
Author

I haven't succeeded in having the bookmarklet to auto-populate the URL into the form.

I examined perma_web/static/js/create-link.module.js to see if I could understand where it is going wrong.

Using the Firefox debugger and loading https://perma.cc/manage/create?url=https%3A%2F%2Fwww.northeastern.edu, I got to the init function.

$url = $('#rawUrl');
populateOrgDropdown();
populateFromUrl();
setupEventHandlers();
}

When my Firefox gets to line 434, it tries to get the URL input text box, but that does not exist yet. So $url.length == 0, an empty selection. Then populateFromUrl(...) is called on line 437.

export function populateFromUrl () {
let url = Helpers.getWindowLocationSearch().split("url=")[1];
if (url) {
$url.val(decodeURIComponent(url));
}
}

url and decodeURIComponent(url) are correct ("https%3A%2F%2Fwww.northeastern.edu" and "https://www.northeastern.edu"). However, $url.val(...) on line 299 doesn't do anything due to the empty selection.

Then, after the page loads, the URL in the address bar is rewritten to omit the url variable.

@rebeccacremona
Copy link
Contributor

Thanks for this debugging, Cody!

We think we just deployed a fix: we are in the middle of a gradual migration to a VueJS-mediated frontend, and this functionality slipped through the cracks.

We believe the bookmarket is now back in gear!

@codydunne
Copy link
Author

Hrm... It doesn't seem to be working for me. Has the change been deployed yet?

I tried a hard refresh of the perma.cc create new link page with no luck.

The bookmarklet generates this URL for https://www.northeastern.edu:
https://perma.cc/service/bookmarklet-create/?v=1&url=https%3A%2F%2Fwww.northeastern.edu%2F
That redirects to
https://perma.cc/manage/create?folder=252719&url=https://northeastern.edu
and then rewrites the URL to
https://perma.cc/manage/create?folder=252719

@rebeccacremona
Copy link
Contributor

@codydunne I'm so sorry: I jumped the gun and this is still in QA 😳. I will message again when it is actually deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants