Forum Moderators: open
I am trying to get simple Java script applets to function in IE 5+ on Mac and PC.
What seems to work on PC will not work on Macs. Particularly, I'm looking for some Java script which will select all and copy the content of an HTML page to the clipboard/scrapbook of PC's and Macs. Even a select all/highlight all which works across both platforms would do!
I've seen it done, and I've found it for PC but it won't work on Mac IE. I am wondering, in general terms, if there is anything I should consider or adjust in the coding for getting Java to work in IE across platforms consistently?
Or is Apple Script an option for use in an HTML page - in a similar way to a Java applet?
I appreciate that this is probably a 'big issue' and there are no simple answers, but any suggestions would be most welcome.
Thanks
Java uses applets.
JavaScript uses, well, scripts.
And then there's jScript - Microsoft's version of javascript
Also, there's ECMAScript - which is the standard which JavaScript and jScript "should" be following.
Applescripts, as I undertand them, are used to automate repetitive tasks done locally on the machine, like renaming a whole bunch of files. As I understand it, Applescripts work within the file structure of the Mac, but they're not contained on an HTML page. I'm no ace on this - so please let me know someone if I'm wrong.
Now, you are, I believe, talking about JavaScript. As far as I know the select function in JavaScript is limited to selecting the content of form elements, and therefore cannot be used to select an entire HTML page. However, it will have the effect of highlighting the content inside a form element.
If you've seen the functionality you need and you know where it is, then poke around in their code a bit. If it's JavaScript, you'll be able to see the whole thing.
Javascript gets installed with the Browser - and the Mac version of a browser should work basically the same as PC version. However, if the code includes non-standard terms (i.e proprietary terms from Microsoft's jscript accessing objects that only exist for IE) then you'll have problems, not only on Macs, but even on PCs running other browsers.
Yes, I'm talking about JavaScript - thanks for your thoughts which are useful as ever.
I must admit, I was hoping for a route which would select all on an HTML page without it being in a form element.
As I've seen a lot of JavaScript functions not work on a Mac or on Netscape, I did think that this was due to the tight integration of Javascript into Windows and IE browser.
Looks like I'm back to the drawing board (not for the first time!)
Applescripts, as I undertand them, are used to automate repetitive tasks done locally on the machine, like renaming a whole bunch of files. As I understand it, Applescripts work within the file structure of the Mac, but they're not contained on an HTML page. I'm no ace on this - so please let me know someone if I'm wrong.
OK. You are wrong. Well, more accurately, not exactly right. ;)
AppleScript can be used to rename files. However, it can also be used to control applications. Most apps have an AppleScript dictionary that will allow you to control certain features for that particular app. For instance, I can write an AppleScript to create a new mail message in Outlook Express, merging data from my database, and then send that message to whoever it is addressed to. The trick is that the application must have those features enabled via AppleScript.
You are right, though, that one can not put AppleScripts in an HTML page. (If you run Mac OS X as your webserver, then you can have AppleScript act like any other CGI application (e.g., perl), but that is on the server side.)
And, you are also correct about the JavaScript differences on the Mac. Microsoft used non-standard JS and Java, just to prevent other platforms from having the same functionality-- the opposite of what Java was supposed to do. But, that is another story...
The web site I am creating will pull together data to make a 'specification' for the user which will be displayed on a 'static' HTML page. The page would not contain frames.
Ideally, the user may want to put this specification into a Word processor, or a page layout program like Quark.
What I was trying to achieve is a situation where the user can click a button, saying 'Select all & Copy', the entire contents of the HTML page would be selected. They would then be able to 'manually' copy and then paste the contents of that HTML page into their WP or page layout program.
I (and a very talented programmer) have been able to achieve this for the PC/Windows user with a piece of script which selects all and copies the contents of the page to the Windows Clipboard. However, we can't get this to work in IE on a Mac. For various reasons, I want this functionality to work 'locally' within the browser rather than as a CGI on the server.
I have (thanks to the help of the great people on this Forum) found a Javascript which DOES work on IE PC and Mac provided the text is in a form element.
The problem is, I want the whole HTML page to be copied and retain the text styling and formatting. Therefore, putting the text in a large comments form field just won't work.
Think that's about the size of it - thanks for your interest and help.
Mark
If I were you, I would probably generate a text file based on user input that is either .rtf or .html (or maybe .pdf) and allow the user to download that file and save it to disk. That way, they can open the file in whatever they want and be able to keep the formatting without relying on any scripts or any other add-ons, i.e.,-- downloading a file is part of what browsers do natively.
Do you think this will work?