Question

Execute JScript in FireFox

Asked by: PaulCaswell

All,

I have a JScript tool I use in Explorer on web pages. I can drag the tool from my favorites onto the page and it is performed on the page contents.

How can I do the equivalen in FireFox?

Paul

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-04-09 at 11:11:06ID21807403
Tags

firefox

,

jscript

,

execute

Topic

JavaScript

Participating Experts
3
Points
125
Comments
20

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. JMail & JScript
    Is it possible to use JMail in a JScript page?
  2. JScript Encoder
    Hey people. I want to use the JScript Encoder to encode my scripts. Also, I want to know how to fullscreen the windows media player with JScript.NOTE: I have already tried the microsoft website and it didn't work in the command line or in the RUN dialog box! Regards.
  3. JScript Image Problems with IE
    I'm not really sure what the actual problem is here, but I assume that it has something to do with the JScript on the page I'm building. I believe this because I know that Firefox tends to repair and/or overlook some script errors and make the page function correctly. I'm bui...
  4. good practices for write jscript code
    Hi, I make an html page with a lot of jscript. But this code run slowly. I need that it work more fast. I see in same page the tag <script> with the attribute src=’one file.js’, and the source of java script in one file.js is it more fast the execution when I use ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: TimYatesPosted on 2006-04-09 at 11:45:50ID: 16412496

You mean a bookmarklet?

ie put the following as the location of a new bookmark:

    javascript:function d(){ alert( document.title );};d();

then when you click the bookmark, it will alert you with the current page title...

Tim

 

by: PaulCaswellPosted on 2006-04-09 at 12:04:02ID: 16412545

>>You mean a bookmarklet?
So it is possible!

I have a tool in C:\Tools\MyTool.js. What do I change my bookmarklet (how cute) to so it executes instead of opening?

Paul

 

by: TimYatesPosted on 2006-04-09 at 12:12:43ID: 16412576

ahhh...  now it gets tricky...

I never found a way of doing this :-(

I only managed to execute commands less than 1000 chars (or something) in length, due to restrictions in URL length (under IE)

It *may* be possible to add a link to your script into the page, then execute commands from the script, but I would imagine you'd hit all sorts of cross-site scripting security issues...

What is it you're trying to do?  Maybe something already exists to do it?

Tim

 

by: PaulCaswellPosted on 2006-04-09 at 12:19:40ID: 16412593

Its actually a points splitter I found. It was written by DanRollins. Essentially, you hit the 'Split Points' link on your question and then invoke the script. It walks through the question building a list of all contributors and distributes the points equally among them. I doubt if thats possible in one line.

Obviously there's no chance of embedding it in the page.

I used to use Explorer but since I've moved over to FireFox I'm not going back :-) In explorer you just drop the script on the page and it executes.

Paul

 

by: PaulCaswellPosted on 2006-04-09 at 12:21:50ID: 16412601

I am not familliar with JavaScript but something like:

javascript:function d(){ execute( "C:\Tools\MyTool.js" );};d();

would be the sort of thing I suspect I am looking for.

Paul

 

by: mplungjanPosted on 2006-04-09 at 14:19:39ID: 16413029

How big is it?
If it is not too big, take the script and make sure you have ; between each statement and then remove the linefeeds.
Then it is a bookmarklet

 

by: mplungjanPosted on 2006-04-09 at 14:20:40ID: 16413034

 

by: PaulCaswellPosted on 2006-04-09 at 14:59:19ID: 16413256

Looks like progress!

It doesnt work for me! I've traced it back to extracting the inner HTML. If I do 's=document.body.innerHTML;alert(s.length);' I get zero. Any ideas?

The code looks like:
"javascript:function splt(){s=document.body.innerHTML;alert(s.length)..."

Paul

 

by: PaulCaswellPosted on 2006-04-09 at 17:35:16ID: 16413787

This gives '0':

javascript:function splt(){var s=document.body.innerHTML;alert(s.length);}splt();

What am I doing wrong?

Paul

 

by: TimYatesPosted on 2006-04-10 at 00:28:30ID: 16415055

Strange...  it gives me a number... :-/

I'm on Firefox 1.5

 

by: PaulCaswellPosted on 2006-04-10 at 01:28:04ID: 16415302

>>I'm on Firefox 1.5
1.5.0.1!

Oddly though, after it executes, my Bookmarks sidebar goes blank! Could I have an extension that's interfering?

Happens on other sites too!

Paul

 

by: TimYatesPosted on 2006-04-10 at 01:32:09ID: 16415324

Works on mine :-/

 

by: ndixonPosted on 2006-04-10 at 02:30:18ID: 16415601

this is a little out of your topic area, but...

JScript has descrete differences to Javascript JScript - JScript is microsoft's own take on the scripting language, and although for the most part it is compatable in other browsers, it contains features that are only available in IE.

 

by: PaulCaswellPosted on 2006-04-10 at 11:19:40ID: 16419841

All,

I disabled all my extensions (wierd feeling) and tried it again:

javascript:function splt(){s=document.body.innerHTML;alert(s.length);}splt();

Still showing '0'. Any more thoughts?

Is there any other way of getting the contents of the current page?

I keep feeling that the disappearance of the bookmarks sidebar after execution is important. What might that mean?

Paul

 

by: TimYatesPosted on 2006-04-11 at 00:48:51ID: 16424317

>> I keep feeling that the disappearance of the bookmarks sidebar after execution is important. What might that mean?

It's odd, because mine doesn't disappear :-/

 

by: PaulCaswellPosted on 2006-04-11 at 11:38:45ID: 16429978

A technique I often use to track down bugs is to try to discover how I would do it deliberately so:

How would you make the sidebar go blank (if its there) and both appear AND be blank if its not there, using JScript?

Paul

P.S. Could this be a FF Version issue? As I said, I have 1.5.0.1. Is that the same as yours? Are you running Windows XP-SP2 like me?

 

by: TimYatesPosted on 2006-04-11 at 11:49:56ID: 16430095

Yeah, I'm on the same version...

I just spotted if you click "Load in side bar" in the bookmark properties, it DOESN'T work, and does like you say

So uncheck that, and give it another try ;-)

Tim

 

by: PaulCaswellPosted on 2006-04-11 at 12:08:43ID: 16430253

Wow! I didnt spot that! Good catch! That explains the whole thing! Even the blanking of the sidebar!

My fragment now gives me 61481 for this page so I should be able to resurrect the original and test it.

I think I'll split the points here :-)

Paul

 

by: TimYatesPosted on 2006-04-11 at 12:18:17ID: 16430329

yay!  yeah, now the code mplungjan gave here http:Q_21807403.html#16413034 should work fine :-)

i dont use the sidebar...  that's my excuse anyway ;-)

good luck!

Tim

 

by: PaulCaswellPosted on 2006-04-11 at 13:12:00ID: 16430862

It worked! Thanks all!

Here's the code in case anyone wants it! I added a bit to the original to not give me any points and a few other bits.

javascript:function splt(){s=document.body.innerHTML;nOffset=s.indexOf("Points must total ");nPoinx=parseInt(s.substr(nOffset+17,4));aLizards=new Array();aEdBoxIDs=new Array();nCnt=0;for(j=0;j<document.anchors.length;j++){s=document.anchors[j].parentNode.innerHTML;n=s.indexOf('points_');sEdboxID=s.substr(n,15);n=s.indexOf('Comment from');s=s.substr(n,n+60);nNameStart=s.indexOf('>')+1;nNameEnd=s.indexOf('</');sLzrd=s.substring(nNameStart,nNameEnd);if(aLizards.toString().indexOf(sLzrd)==-1&&sLzrd!="PaulCaswell"){aEdBoxIDs[nCnt]=sEdboxID;aLizards[nCnt++]=sLzrd;};}nPoinxPerLizard=parseInt(nPoinx/aLizards.length);for(j=0;j<aLizards.length;j++){document.getElementsByName(aEdBoxIDs[j])[0].value=nPoinxPerLizard;}nAssigned=nPoinxPerLizard*aLizards.length;if(nAssigned!=nPoinx){alert('Leftover:'+(nPoinx-nAssigned)+' poinx!!!')};}splt();

Paul

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...