doa24uk Posted October 9, 2009 Share Posted October 9, 2009 Hi guys, This works perfectly .... var mySplit = "123456789"; var mySplitResult = url.split("5"); window.open('http://none.com/mypage.php?id=' + mySplitResult[0], 'window name') So why doesn't this ?? (presume the selected text is "123456789" - same as the above example) --> var focusedWindow = document.commandDispatcher.focusedWindow; if (focusedWindow == window) focusedWindow = getBrowser().contentWindow; var url = focusedWindow.getSelection(); var mySplitResult = url.split("5"); window.open('http://mirrorchecker.com/linkchecker2.php?url=' + mySplitResult[0], 'window name') Quote Link to comment Share on other sites More sharing options...
salathe Posted October 9, 2009 Share Posted October 9, 2009 In your second code block, the value of url will not be a string (it'll be an object for the selection). A quick fix (I guess, not tested) would be: var url = focusedWindow.getSelection().toString(); Quote Link to comment Share on other sites More sharing options...
doa24uk Posted October 9, 2009 Author Share Posted October 9, 2009 I thought it would be something like that (not being in a useful form) but don't know JS that well. Good news is that your code did the trick! Many thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.