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 6056373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:22:09+00:00 2026-05-23T08:22:09+00:00

I am doing some contract work in which I need to write small snippets

  • 0

I am doing some contract work in which I need to write small snippets of Javascript for client sites and then make sure that they work in all browsers.

I don’t have access to the sites’ servers themselves, so I need to be able to inject the snippets some other way.

I tried writing a proxy script in PHP that grabs the site’s source code, absolutizes all the URLs, and then injects the Javascript, and that works for some client sites (and has the advantage of being easily testable in multiple browsers).

But some Javascript-heavy sites don’t work with this approach — they’ll do stuff like testing the window.location to make sure it isn’t spoofed, or they’ll include references to files on the local server that the proxy script isn’t able to filter.

As an alternative, I suppose I could use Greasemonkey to inject the Javascript … which would let me see how the code looks in Firefox, but then how do I test in, say, IE6?

Can anyone suggest a way to do cross-browser Javascript development when you don’t have access to the site on which the Javascript will eventually reside?

  • 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-23T08:22:09+00:00Added an answer on May 23, 2026 at 8:22 am

    You can use a bookmarklet to insert your JavaScript by injecting a script tag.

    The code itself would look something like this:

    (function() {
        var d = document,
            s = d.createElement('script'),
            t = d.body || d.getElementsByTagName('head')[0] || d.documentElement;
        s.src = "http://path/to/your/script.js";
        t.appendChild(s);
    })();
    

    Then just bookmark-ify it (search for “bookmarklet maker” and you’ll find a bunch to do the work for you). You bookmark the result, visit the page you want to test on, and click your bookmark to do your testing.

    For instance:

    javascript:(function(){%28function%28%29%20%7Bvar%20d%20%3D%20document%2Cs%20%3D%20d.createElement%28%27script%27%29%2Ct%20%3D%20d.body%20%7C%7C%20d.getElementsByTagName%28%27head%27%29%5B0%5D%20%7C%7C%20d.documentElement%3Bs.src%20%3D%20%22http%3A//jsbin.com/ajubo4%22%3Bt.appendChild%28s%29%3B%7D%29%28%29%3B})();
    

    If you copy that into a bookmark’s URL, when you activate the bookmark on any major browser it loads a simple script from http://jsbin.com (which you can find here) that does an alert telling you how many p elements are on the page. (There are, at the moment, 23 on this page.)

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

Sidebar

Related Questions

After doing some work with Ruby, Rails, and RSpec last summer and I learned
While doing some JavaScript performance tests I came up with the following piece of
Been doing some playing call my service which is on a different domain using
While doing some small regex task I came upon this problem. I have a
I am doing some work with a 3rd party supplier who provide data via
I'm doing some R&D work, and as such am exploring design patterns. I have
doing some quick web dev work for a local body modification parlour just in
Doing some jquery animation. I have certain divs set up with an attribute of
While doing some random experimentation with a factorial program in C, Python and Scheme.
While doing some refactoring I've found that I'm quite often using a pair or

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.