15

Just as we have http://www.sliver.com/dotnet/SnippetCompiler/ (link inactive on 2021-04-24) to test a C# code quickly, I can also do the same for javascript in chrome debugger tools and Firebug (firefox).

I would be more interested in a tool or some online tool which can run a small piece of javascript and tell if it properly runs in prominent browsers and the result.

UPDATE:
I'm a developer and not tester. I don't want to install all browsers on my PC. I like chrome and I can debug/test (for syntax/result) almost every javascript quickly in chrome by just clicking Ctrl+Shift+J and pasting my javascript in its console. But that will just test if it works in chrome. I'm not interested in creating a library right now. Google and Stackoverflow helps me get the greatest and latest javascript for a specific task very quickly.

1
  • I know this is a pretty old thread, but checking in to see if anybody found any such tool. It would be invaluable combined with a Unit Testing framework. Commented Jul 26, 2016 at 5:21

5 Answers 5

7

I found one way. But it is not that quick and still would like to know better answer. May be some kind of tool which can do this.

One Way:-
Write your javascript enclosed in try-catch block on JsBin and create its public link. Now check your link with BrowserShots.

Write considerable amount of html (conditionally) using javascript to be able to see the difference on Images given by BrowserShots.

Sign up to request clarification or add additional context in comments.

Comments

4

To propose another option 10 years down the line: I would suggest using JSHint for this.

The first page as you navigate to their site allows you to simply paste a JS snippet and get information regarding everything from potentially confusing syntax to "minimum ES version" warnings.

Furthermore, you can also install JSHint to your project and have a command to either run manually or slot into your existing build chain to do the same thing locally with custom rules.

Comments

2

I've also found this tool: JS Compatibility Checker, which is based on Can I use. Could be helpful, but won't outline every issue.

Comments

0

You can easily make a test page to house your snippets, then try them in your target browsers. That has the added advantage of providing a central library for the snippets you do create, so you don't have to go hunting through entire directories looking for that cool little widget you created back in 2010.

5 Comments

Good Idea. But I don't want to install firefox/opera/safari etc just for this.
@Ismail: Nota Bene: If you're doing web development you should have them all installed anyway. Sad, but true.
Testing is done by testers. We have separate CSS designers. I just work on logic part. Do you still think I should have them all?
@Ismail: If it's ever your responsibility to fix bugs cross-browser, it seems like a no-brainer to have the browsers in your arsenal. It's not like it costs you anything.
Agreed! I will install it. I know that's only one of the solution for now. But will you agree that a small portable tool to test crossbrowser ability of a small snippet of javascript or a javascript function will help a lot (in terms of saving time and ease of verifying workability of their code) to not just me but all the web developers?
0

Also, you can check the MDN Web Docs Browser Compatibility section if that interface is available (Eg. window.location - https://developer.mozilla.org/en-US/docs/Web/API/Location#browser_compatibility)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.