Reputation: 10863
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.
Upvotes: 15
Views: 10838
Reputation: 885
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.
Upvotes: 2
Reputation: 451
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)
Upvotes: 0
Reputation:
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.
Upvotes: 4
Reputation: 10863
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.
Upvotes: 7
Reputation: 31883
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.
Upvotes: 0