whininguser
01-17-2009, 02:44 AM
Instead of using javascript:alert('hi'), suppose I store alert('hi') in x.js and put it on host.com/x.js. Is there a way to execute host.com/x.js directly from the address bar using javascript:? Thanks.
|
||||
How to run a js file from the address barwhininguser 01-17-2009, 02:44 AM Instead of using javascript:alert('hi'), suppose I store alert('hi') in x.js and put it on host.com/x.js. Is there a way to execute host.com/x.js directly from the address bar using javascript:? Thanks. A1ien51 01-17-2009, 02:57 AM javascript:var scr=document.createElement("script");scr.src="http://example.com/asdf.js";document.getElementsByTagName("head")[0].appendChild(scr);void(0); after you call that, you can use your JS file. Eric whininguser 01-17-2009, 03:12 AM I've asked this on 5 different sites, and you are the only person who has a solution, and it worked perfectly. Thanks for saving my day! whininguser 01-17-2009, 05:16 AM I just tried to put your trick to some work and ran into another problem My fla has only one empty frame and my actionscript has only one line: getURL("javascript:var js=document.createElement('script');js.type='text/javascript';js.src='hosturl/x.js';document.body.appendChild(js);void(0);", "_self"); After I compile the fla and play the swf in my browser, x.js is executed, but there is an infinite loop that causes the x.js to be executed repeatedly. Any idea on how I can get out of this infinite loop? Thanks. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum