5

How do I execute JavaScript from an iMacro script?

URL GOTO=javascript:alert("TEST");

The Javascript works fine when pasting it into the address bar (by putting "javascript:" in front of the code) but unfortunately iMacros does not recognize this as a valid URL.

So since this doesn't work, what's the correct way to run JavaScript from an iMacro script?

0

2 Answers 2

4

Try something without a dialog. For example: URL GOTO=javascript:console.log("TEST"); or URL GOTO=javascript:function<SP>test(){status="TEST"};void<SP>test();

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

1 Comment

I think there should be addon to enable js execution in navigation bar.
0

make a separate java-script file and then call it from your macro using

URL GOTO=imacros://run/?m=your-javascript.js

note that this method is not actually perfect cause imacros does not support calling javascript files from within macros, so this is a workaround and may have certain side effects - enterprise imacros support callback for javascript files.

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.