Combining user script with an existing web page : cross-browser ways?

D

Douglas Crockford

HopfZ said:
Is there a way to make a (cross-browser) javascript function that will
open an existing webpage (for example, www.google.com) in a new window
(or in some part of _self) and then load a specified user script?
like this way:
openWithUserScript(
'http://www.google.com',
'http://www.my_homepage.com/my_script.js'
);

Tell us more about what you are trying to accomplish this. Is this intended to
be some sort of phishing attack? By injecting your script into someone else's
page, the user believes that the page is safe to interact with, but your script
captures their secrets.
 
H

HopfZ

Douglas said:
Tell us more about what you are trying to accomplish this. Is this intended to
be some sort of phishing attack? By injecting your script into someone else's
page, the user believes that the page is safe to interact with, but your script
captures their secrets.

There are webpages that provide online javascript interpreter.
There are also webpages that provide a textarea element and some
buttons that do some simple text processing:
regex test,
finding all urls in the text then linkifying them all,
taking the multiline bookmarklet code in the text then creating a
bookmarklet link.
And I want to combine a javascript interpreter with a textarea element
and some convenience functions for simple text processing. Then when
you use the combined page as a javascript interpreter, you can assign a
long multiline text into a variable easily by running the code like var
a = theTextAreaElement.value;. When you use it as an online text
processing page, you can either press the provided buttons with fixed
functions or run javascript code to do more flexible things with the
text.
Currently I know three ways to accomplish such combination:
1. make both interpreter part and processing part with my own hand.
2. make a bookmarklet that will add processing part to a specific
online javascript interpreter page.
3. Greasemonkey. only for Firefox.
I might do the second way because I am too lazy to construct javascript
interpreter myself. But then if somebody need to use the combination,
she have to drag the bookmarklet to the browser toolbar and also click
the bookmarklet. She wouldn't have to do that if I did the first way.
If openWithUserScript is possible, both of she and I can enjoy lazyness.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top