Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7002701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:57:45+00:00 2026-05-27T20:57:45+00:00

This is my current bookmarklet: javascript:(function(){ alert(location.href); })(); which seems to work fine, but

  • 0

This is my current bookmarklet:

javascript:(function(){ alert(location.href); })();

which seems to work fine, but for me, it doesn’t work on youtube under chrome for some reason.. is there a more robust way to get the location.href? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:57:45+00:00Added an answer on May 27, 2026 at 8:57 pm

    No. You may try

    (function(window){window.alert(window.location.href)})(this);
    

    which will make sure you’re not using some custom alert function from the global namespace. But, there is no way prevent window.alert from being overwritten like so window.alert = function () { console.log('Haha!'); };.

    The location object should be fail-proof, since the browser’s internal setter method inhibits any shenanigans there (meaning that window‘s location attribute is effectively write-protected, as is window.location‘s href attribute)

    Edit:
    Looks like bookmarklets don’t work in Firefox 6+ due to “social engineering bookmarklet attacks”, and there’s nothing you can do about it.
    https://stackoverflow.com/a/6643466/27862
    https://bugzilla.mozilla.org/show_bug.cgi?id=527530

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm making a bookmarklet to my website, and for now i have: <a href=javascript:location.href='http://website.com/compartir_link.php?url='+encodeURIComponent(location.href)
I've developed a JavaScript Bookmarklet that have appended div to the current page. But
I've created a javascript bookmarklet that gets the current page's title and URL, using
i have this js bookmarklet that makes all the current page's font colors black.
This is my current bookmarklet code. if (1 == 1) { var jQ =
Hi i would like to make my map zoom into my current location. This
I've got a bookmarklet which is meant to change the current URL. The code
I have the following javascript bookmarklet which opens a new popup window with a
I have this current script which works great for changing class names $('#mydiv li
Background: I have written a bookmarklet (JavaScript) that appends an iframe to the current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.