473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IE 6 Bug - Is DHTML Becoming Too Powerful? Cross-domain scripting not allowed

Hello,
I really believe that IE 6 has a new (intentional?) bug that severely limits the capability of dhtml and cross domain scripting. Yesterday, I read an interesting article about the subject and it only supported my claim. The article explained why Microsoft will not be letting the IE DHTML Implementation get any more powerful than it already is. Microsoft has realized that an experienced DHTML developer can create a web application that looks and performs just like a desktop application. It doesn't take a rocket scientist to realize the impact that this will have on the sales of Microsoft's new Core Development Products and Technologies (WinForms, C#, .net).

After I read this article, I started to think about an .hta script that suddenly quit working when I upgraded from IE 5 to IE 6. The script used cross domain techniques but nothing really fancy. To make matters worse, I have tried extensively to update and fix my script with no luck. I still receive 'Access Denied' errors.

If you are interested, I have prepared a simple code example containing a dhtml 'one-liner' which demonstrates the cross domain scripting technique that I have been ranting about. To use the example, save the code to a file with the .hta extension. Double click the .hta file to execute it. The application is very simple. Select some text with your mouse and click the 'Get HTML' button. The button is suppose to (and did under IE 5) pop up an alert message that contains the HTML snippet which corresponds to your selection. To try and fix the script, I added the application="yes" attribute to the IFRAME Tag. According to the documentation, this is a new requirement for IE 6. It is suppose to lower the security constraints for the iframe, thus enabling cross domain scripting. It didn't work. Do take note that the example works when the html file in the iframe is on your local machine (example- change the 'src' attribute of the iframe to 'c:\file.htm' or something).

Code Example:
[HTML]<html>
<head>
<TITLE>Simple Cross Domain DHTML Mouse Selection Script</TITLE>
<HTA:APPLICATION ID="HTAEx"
APPLICATIONNAME="HTAEx"
ICON="e.ico"
WINDOWSTATE="normal">
</head>
<body>
<input type="button" value="Get HTML" onClick="getText()"><br><span><br>
<iframe Application="yes" src="http://msdn.microsoft.com" id="TheFrame" style="width: 100%; height: 85%"></iframe>
<script language=JScript>
function getText()
{
var doc = window.frames.TheFrame.document;
var text1 = doc.selection.createRange().htmlText;
alert(text1);
}
</script>
</body>
</html>[/HTML]

Let me know what you think.
Oct 8 '06 #1
3 2497
acoder
16,027 Expert Mod 8TB
Conspiracy theories, don't you just love 'em? ;)

JavaScript doesn't allow cross-domain access unless in reduced security, e.g. "file:" or when granted privileges. You can use Ajax which allows server-side code to be run without reloading the page - now that's a lot more powerful than DHTML!
May 19 '08 #2
gits
5,390 Expert Mod 4TB
hi ...

there are some common and known issues with cross-domain-requests and at this moment it is 'good' that JavaScript doesn't allow that ... but on the other hand you are limited in creating mashups and something like this and you have to make server-turn-arounds to achieve this with serverside request proxies etc. ... here is an interesting read about that ... which in short describes an idea where the developer could give permission to a cross-domain-request ... i think that would be a quite good solution for the need that often appears with that issue ...

kind regards
May 19 '08 #3
acoder
16,027 Expert Mod 8TB
Another method of cross-domain access is by using JSON with dynamic script tags.
May 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Arthur | last post by:
Did I hallucinate something about __name__ becoming read-write? Not in alpha2. Can't find the reference to this I thought I read - that it was concluded to be necessary in connection with...
3
by: Thomas Kemetmüller | last post by:
Hi folks! I'm searching for a cross browser compatible DHTML popup calendar, there are plenty of those on the web, but I need one, which is absolutely free, very simple and good looking, do you...
1
by: Catherine Lynn Smith | last post by:
OK, I know this issue has been beat to death, but I have tested my script in Netscape 7.1 and it does seem to be getting the calculated values it needs to create placement coordinates, and every...
21
by: Nik Coughlin | last post by:
Are there methods for manipulating images in JavaScript that would allow me to write functions to rotate, skew, mask and resize images (bitmaps)? The functions need to be fast enough for use in a...
6
by: Terry | last post by:
Hi, I like the DHTML-based pop-up window script made available by this company. However, their script only works under the quirk mode for IE 6 and Firefox. http://www.ferant.com I wonder...
3
by: cjl | last post by:
Hey all: I'm stuck. I'm using the code from www.quirksmode.org for cross browser access to HTML elements, but I'm getting a javascript error. The relevant code: function getObj(name) { if...
2
by: Questman | last post by:
Good afternoon, Does anyone have any code that implements, or approaches implementing, a cross-browser DHTML/JS solution to provide an Excel-like Grid on a web page - I'm trying to convert an...
6
by: petermichaux | last post by:
Hi, I've been thinking about unit testing DHTML widgets. Is the only real way to create small examples/test files and manually run each in a bunch of browsers? Thanks, Peter
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.