Bug Tracker

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5366 closed bug (duplicate)

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.

Change History (3)

comment:1 Changed 14 years ago by pbcomm

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.

comment:2 Changed 14 years ago by dmethvin

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.

comment:3 Changed 14 years ago by bounsy

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".

Note: See TracTickets for help on using tickets.