Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This seems simple enough (to me) but I can't get a straight answer anywhere... so maybe it's actually NOT possible??

    I want to run a local javascript file from a bookmarklet in IE7, rather than run into the URL length limit by trying to squeeze the whole script on to one line. It would look something like this:

    javascript: <some command to reference and run the file test.js located on my local HD>

    Surely (hopefully) there's a way?

    Alan

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post
    Alan from my understanding you don't have to run it into one line and have it just written with your usual hard returns and can have some semi-colons removed. By the wording of your question am I to assume you have a rather long script that is limited by the available string length?

    Whilst writing this I have hadan idea so bear with me and I will test it out
    Jerry

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post
    OK I am back

    Try this code

    Code:
    javascript:var js=document.createElement('script');
    js.type='text/javascript';
    js.src='localhost/alan.js';
    document.body.appendChild(js);
    void(0);
    You may have to change the js.src to 127.0.0.1/alan.js where alan.js is the js file containing your script
    Jerry

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jezza View Post
    OK I am back

    Try this code
    ...
    You may have to change the js.src to 127.0.0.1/alan.js where alan.js is the js file containing your script
    Many thanks Jezza. I'll give that a shot. To specify the file on local host, what is the syntax to point to, say,
    C:\My scripts\alan.js ? Not being focused much on web stuff, I always screw up the quotes and slashes and cetera.

    Also, I found some scripts on The Anatomy of a JavaScript Bookmarklet, which I can't get to work unfortunately. I kinda get what's (meant to be) happening, but the MainApp reference has me a little confuted.

    Will let you know my outcomes.


    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •