Skip to main content

Bug Tracker

Side navigation

#5366 closed bug (duplicate)

Opened October 14, 2009 03:11AM UTC

Closed October 14, 2009 03:42AM UTC

Last modified October 14, 2009 03:59AM UTC

Unwanted page reload when using load funciton in Firefox to serve random affiliate ads

Reported by: bounsy Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

A detailed set of test cases I came up with can be found here (with more discussion above this comment):

http://drupal.org/node/355251#comment-2148332

Essentially, I am trying to serve up random ads on my site using the jQuery load function (which is being used by the advertisement module in Drupal). Some of the ads are from affiliates that include JavaScript files that include document.write function calls in them. In Firefox, this causes the page to reload and show only the ad against a blank background. Internet Explorer works correctly.

Attachments (0)
Change History (3)

Changed October 14, 2009 03:23AM UTC by pbcomm comment:1

This is NOT a jQuery issue. Most ad companies deliver their content by using document.write. Try using iFrames to host your ads or inserting the code directly into html page.

Changed October 14, 2009 03:42AM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

I agree with pbcomm on the right way to deliver ads; they really should be in an iframe so they're isolated from the page. There are several tickets already open regarding the processing of scripts via ajax including #4826 so I'll close this as a duplicate.

Changed October 14, 2009 03:59AM UTC by bounsy comment:3

It may be a duplicate of the existing case. Is that case being worked on? There are no comments on it.

Here's some test code that has nothing to do with ads that does not work correctly in either Internet Explorer or Firefox.

<html>
<head>
<script type="text/javascript" src="/misc/jquery.js"></script>
</head>
<body>
<h1>test</h1>
<div id="group-id-1">
 <script type="text/javascript">
//<![CDATA[
  $(document).ready(function(){ jQuery("div#group-id-1").html('<div align="center"><script type="text/javascript" language="javascript">document.write("<h1>foo</h1>")</' + 'script></div>'); )});
 //]]>
 </script>
</div>
</body>
</html>

In Internet Explorer, the text "foo" is never displayed. In Firefox, the entire page is replaced with the text "foo".