Page Containing Non-Secure Item?

At work, the web application that I’ve been developing has always had this problem over a secure SSL link. On certain pages, before the document is fully loaded, a dialog box will popup telling me that “This page contains non-secure items, would you like to display those items?”. Whether I choose ‘Yes’ or ‘No’ does not really make a difference, and the application can still be executed perfectly. However, this dialog box is really annoying to the point that many people in the office has turned off this checking in their Internet Explorer preferences.

Dialog Box

We have been digging through all our code to see whether we have explicitly refer to an URL using the ‘http’ protocol, instead of leaving it relative. However, the search has not been successful and all our code shows that we are using the URL’s correctly. This is getting even more annoying today as some of my new Javascript widgets will popup this message when they are in operation. Right click somewhere to bring up a context menu – BANG! There is that annoying dialog box asking you to confirm. So I decided that I must go and figure out what actually caused this problem.

Searching through trusted Google does not yield many useful result. Actually a lot of sites on the first result page actually state the same problem. They tell their custom to simply ignore the dialog box when they are using the application. It is not right! That’s avoiding the problem! Until I hit this page on the DevShed.com…

It does not present a clear answer, but I think I found the solution on here.

Make Sure You Have SRC Attribute In Your IFRAME!

We have quite a few IFRAME tags in our code, either pre-generated or appended to the document using DOM. Many of them are pointing to a relative URL when they are created, however, some of them are just created as hidden place holders. They are used in DHTML to replace some DIV code because DIV does hover well above the editing widgets. They are created without a SRC attribute, because their documents are created on the fly! Because the document does not have an URL, Internet Explorer gets confused and thus yield a warning on displaying non-secure items.

It ends up as an easy fix – just create thus IFRAME’s with SRC pointing to a dummy page using a relative URL.

Category: Technology | Fri, 21 February 2003 6:34 pm

Links to This Article

  1. Sun, 18 February 2007 8:21 am
    Do you want to display the nonsecure item - (dialog in IE) « Ideas, Ideas, Ideas
  2. Mon, 30 April 2007 8:50 pm
    JIRA: Real Practice Suite

Comments

1.
Avatar for Shailesh Powdwal
Posted by Shailesh Powdwal on Fri, 19 September 2003 9:47 pm

Scott

This is THE problem I am also facing on my web site. Because of this my application, which is very much perfect in all other requirements specs. Customer is not accepting it. I tried every possible thing, but in vein.

I have already given SRC to all the IFRAMES I am using. I still get that ugly message.

Do you have anything else in your mind as a solution to this?


2.
Avatar for Scott Yang
Posted by Scott Yang on Fri, 19 September 2003 10:44 pm

Shaikesh,

If it does not solve your problem, then truly I have no idea. As the error message has suggested, it is caused by elements referring to a non-secure URL. IFRAMEs should all have SRC attribute pointing to something like relative path – a dummy page for example. If you have done that – then I am not sure what else is causing it..


3.
Avatar for kerrie
Posted by kerrie on Tue, 14 October 2003 5:42 am

Just wanted to say THANK YOU!!! This problem was driving me nuts, added a fake src and all is AOK!!!


4.
Avatar for Eduardo De la Cruz
Posted by Eduardo De la Cruz on Wed, 12 November 2003 1:45 am

Thank a lot!!! This topic was very helpfull to me…


5.
Avatar for Eduardo De la Cruz
Posted by Eduardo De la Cruz on Wed, 12 November 2003 1:59 am

If I have a “mail to:” reference, the same error appears, when you click on it. Do you know how can I fix this problem?


6.
Avatar for Paul Geerts
Posted by Paul Geerts on Tue, 9 December 2003 10:56 am

I’ve had the same problem – but I’ve also found some browers are more paranoid than others:
My browser was happy with a sneaky “javascript:;” SRC url. It was also cool with “/blank.jsp”.
However several co-workers machines refused to stop complaining until I fully specified the SRC as “https://hostname/blank.jsp”. It
seems not all IE6 installs are created equal.


7.
Avatar for Scott Dimmick
Posted by Scott Dimmick on Sun, 18 January 2004 11:37 pm

Scott,

Thank you so much for making this so much easier to fix. You saved me a lot of trial and error and research. Thanks a million. :)


8.
Avatar for Rob Fernandes
Posted by Rob Fernandes on Thu, 19 February 2004 11:48 pm

Very helpful… exactly what I was trying to answer. But it doesn’t deal with my exact issue: when the IFRAMED content on a secure page is proudly nonsecure! Trying to separate secure functionality and nonsecure furniture/decoration as separate layers by way of an IFRAME. The IFRAMED content is non secure and throws this dialog box all the time. It doesn’t on Mozilla, Safari etc. First time that IE has been the more frustrating one ;0) Any solutions!?


9.
Avatar for reader
Posted by reader on Thu, 25 March 2004 2:28 am

Thank you, thank you, thank you. This was very helpful.


Avatar for Prakash
Posted by Prakash on Thu, 25 March 2004 9:11 pm

I have an IFrame on a secure page in my application.
The src attribute of the frame is pointing to another site which is also a secured one.But when I navigate to the secure page(which has the IFrame) of my application,I get the same message “..Do you want to display the nonsecure items?”. How do I avoid this?


Avatar for ddy
Posted by ddy on Fri, 10 December 2004 7:17 am

Thank You!
After many hours on google / google groups I luckily found this page.
Adding
src=”/blank.jsp”
to the iframe tag did the trick!


Avatar for shaila
Posted by shaila on Tue, 14 December 2004 5:57 am

I dont have any iframe but instead i have the frameset/frames in my page…can u please tell me how to avoid that popup message in this situation ?


Avatar for scotty
Posted by scotty on Tue, 14 December 2004 7:34 am

shaila,

Same – if your page has a https address, make sure all your frames in frameset also have https addresses.


Avatar for Danish
Posted by Danish on Mon, 31 January 2005 8:26 pm

This is really a wonderful article. I get solved my problem.

Thanks Scott.


Avatar for Ed Allen
Posted by Ed Allen on Sat, 5 February 2005 7:20 am

How do I stop this annoying popup? It is not on my webpage but one that I visit frequently.


Avatar for Guillermo
Posted by Guillermo on Thu, 17 February 2005 6:07 am

Thank you very much. Very helpfull. Saved a lot of work hours.


Avatar for Fi3RC3
Posted by Fi3RC3 on Wed, 9 March 2005 3:28 am

Instead of using a blank page, its easier you can also use:

This way it doesn’t have to check for a file every time.

.fi3rc3


Avatar for Fi3RC3
Posted by Fi3RC3 on Wed, 9 March 2005 3:30 am

sorry….bout the previous post….

use: src=”javascript:false;”


Avatar for Leo Charre
Posted by Leo Charre on Thu, 7 April 2005 11:44 am

I want to mention this to keep some people from getting confused, if that is alright.

If you flip between http to https, any absolute urls listed as http://whatever.com/whatever/img.jpg will show up, but will bring up the ‘mix of secure and non secure items’.
I feel it is important to mention this because a client we had, was having problems having images break when he switched from http to https (he was using absolute server paths ) –
His first solution was to define the full url to the resource, obviously this caused the ‘mix’ alert to come up.

Leo Charre


Avatar for Lukasz
Posted by Lukasz on Wed, 27 April 2005 11:53 pm

Great article! I was desperately looking for a solution for a few weeks. I googled the Web, even employed an HTTP debugger without a success… until I found this page. Thanks a lot!


Avatar for Lukasz
Posted by Lukasz on Wed, 27 April 2005 11:55 pm

Per Fi3RC3 tip I used “javascript:false” URL and it works with IE6!


Avatar for Alberto
Posted by Alberto on Tue, 3 May 2005 10:30 am

I’m really clueless, I’ve tried everything
but the browser still pop ups
“This page contains non-secure items, would you like to display those items?”
I’ve tried javascripts of every kind
always using SRC with absolute and relative path.
I’m really out of ideas.


Avatar for Scott
Posted by Scott on Wed, 4 May 2005 12:45 am

I have the same problem. No IFRAME tags in any of the pages on the site. There are only three things that I can say with any certainty about the problem so far:
a)it has to be within client side HTML that the discrepancy is occuring because the browser doesnt see server side processing. Therefore, its safe to assume that the browser is reacting to something in the post server-process HTML.
b)its only Internet Explorer that gets the message, and
c)whether selecting ‘yes’ or ‘no’ the pages are identical at the binary level, which means non-printable characters, capitalization, everything, is the same.


Avatar for Irfan
Posted by Irfan on Thu, 19 May 2005 7:45 pm

Thanks for the solution provided. I was finally able to resolve this after stepping up at this article.


Avatar for Irfan
Posted by Irfan on Fri, 20 May 2005 9:15 pm

Sorry about the last submit I forgot to add the following,
If you are trying build iframe on fly through javascript on a click on the page add value for the src property as follows

mf = document.createElement(“IFRAME”);
mf.src = “/”;


Avatar for Eric K
Posted by Eric K on Sun, 22 May 2005 10:43 am

I came across a similar issue. The page/application I was working on, however, didn’t have any IFRAMES but it did have a Flash Animation whose OBJECT and EMBED tags had their CODEBASE and PLUGINSPAGE tags pointing to -> http://some.macromedia.page.com. A quick hack around this issue was to change the URL to -> https://some.macromedia.page.com and viola…it worked, turns out macromedia anticipated this and whether you use http or https everything works smoothly!

Just thought I’d post for posterity (in case someone else had the same issue)

PS: This comment post sucks because if you leave out your email address you have to type out the whole thing again! grrr…. Please let people know that the email is also required.


Avatar for Peterpan
Posted by Peterpan on Thu, 9 June 2005 7:39 pm

What about a div is their a way to stop the popup?
this is how my script look like:

function doTooltip(e, msg) {
if ( typeof Tooltip == “undefined” || !Tooltip.ready ) return;
var cntnt = wrapTipContent(msg);
var tip = document.getElementById( Tooltip.tipID );
Tooltip.show(e, cntnt);
}

function hideTip() {
if ( typeof Tooltip == “undefined” || !Tooltip.ready ) return;
Tooltip.hide();
}

function wrapTipContent(msg) {
var cntnt = “”;
if ( msg[0] ) cntnt += ”;
if ( msg[1] ) cntnt += ” + msg[1] + ”;
return cntnt;
}

var messages = new Array();
messages[0] = new Array(‘https://domain.com/images/AAGC011P.jpg’);
messages[1] = new Array(‘https://domain.com/images/AAGC012P.jpg’);
messages[2] = new Array(‘https://domain.com/images/AAGC013P.jpg’);
messages[3] = new Array(‘https://domain.com/images/AAGC014P.jpg’);
messages[4] = new Array(‘https://domain.com/images/AAGC015P.jpg’);
messages[5] = new Array(‘https://domain.com/images/AAGC016P.jpg’);
messages[6] = new Array(‘https://domain.com/images/AAGC017P.jpg’);
messages[7] = new Array(‘https://domain.com/images/AAGC018P.jpg’);


Avatar for vasanth
Posted by vasanth on Mon, 8 May 2006 3:56 pm

Thanks a lot this article in specific was more useful to us.


Avatar for Wildman
Posted by Wildman on Sun, 28 May 2006 9:47 pm

Hi All,
Similar to Sheila’s question…. will a non-secure frameset page that masks a secure page display this annoying pop-up box? (i.e. must the frameset page also be https?) Many Thanks! -Bill


Avatar for scotty
Posted by scotty on Sun, 28 May 2006 9:50 pm

Wildman,

Even with IE it varies depending on the security setting. However if your frameset page is a secure page, then I think it might require all frames to be HTTPS as well.


Avatar for Wildman
Posted by Wildman on Sun, 28 May 2006 10:04 pm

Thanks Scotty!


Avatar for Alex
Posted by Alex on Fri, 9 June 2006 4:22 pm

Here’s the solution, make sure everything points to https, including some things that you may have forgotten about, like I did:
1. javascript external scripts – make the src attribute point to https
2. embedded objects – e.g. Flash, make sure the external references like CODEBASE and PLUGINSPAGE also point to https
3. external css files – same as the js
4. fix any iframe source references

Now within the external javascript files themselves, check any src references or paths WITHIN THOSE FILES. This does not appear to be a requirement for CSS files that have url() references to images (they work fine with relative paths).

Also, BIG TIP:
** Use Firefox / Tools / “Page Info” / “Media” tab, which will tell you which external references are relative, http://, or https://. Super helpful. Once you find the relative paths for external scripts fix those, and then go into those scripts themselves and fix any paths in there.


Avatar for Quarco
Posted by Quarco on Wed, 9 August 2006 10:30 pm

Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you !!!!!!


Avatar for John Goodman
Posted by John Goodman on Thu, 12 October 2006 9:58 am

The reason for the problem is that some of the code (such as Google AdSense code) is making a link to a server in the non-secure mode (http), rather than in the secure (https) mode. When the page runs in the browser, you get the warning message, and nothing you can do to the code can change the problem as the problem is at the source-server, not your server.


Avatar for Josh Justice
Posted by Josh Justice on Wed, 1 November 2006 8:36 am

You rock! Thanks for this great find.


Avatar for Tom Metro
Posted by Tom Metro on Tue, 14 November 2006 10:27 am

If you are adding your IFRAME dynamically, it is important that you set the SRC attribute *before* you add the IFRAME element to your document’s DOM tree. Otherwise IE will generate the security warning, regardless of what you set the SRC attribute to. For more info, see this bug report that describes the same issue and how they resolved it:
http://xinha.python-hosting.com/ticket/114

-Tom


Avatar for Marcos
Posted by Marcos on Wed, 15 November 2006 1:42 am

Excelent tip!!!

For me it worked with: “javascript: false”

Thanks everybody!


Avatar for Kristen
Posted by Kristen on Mon, 27 November 2006 12:43 pm

Hey! My website is:
http://www.everafterrabbitry.com

I am still having trouble. It is on a HTTPS but, i have the error even offline when I’m editting my webpage it talks about an active X and then online it talks about the non secure.

can anyone help? thanks


Avatar for Vijay
Posted by Vijay on Sun, 18 February 2007 8:11 am

Fantastic! It was indeed the src attribute in an IFRAME. once i set to a dummy url, the dialog disappeared. Thanks for sharing the tip. Iam going to hotlink this page in my blog.


Avatar for Sumon
Posted by Sumon on Wed, 28 February 2007 6:53 pm

javascript:false; in iframe src worked for me!!!


Avatar for Ananda Vardhan
Posted by Ananda Vardhan on Wed, 4 April 2007 6:59 pm

our site is on https, i’m not using any iframe or flash even then its popping up.
i’m getting the pop up twice while pressing the button. Any solution for this plz share it..


Avatar for Stefan Hoehn
Posted by Stefan Hoehn on Mon, 23 April 2007 8:26 pm

@Tom Metro: You saved my day!

The sequence in which the iframe is added to the document dynamically is probably why there is so much confusion that some have a solution and some still have problems even though they use the right .src!


Avatar for Robert Hirn
Posted by Robert Hirn on Tue, 29 May 2007 7:22 am

IrFan and Tom Metro

THAT is the solution. Setting the src programmatically before creating the element.

Thank you both!


Avatar for Pranav Joshi
Posted by Pranav Joshi on Fri, 8 June 2007 5:40 pm

Worked for me…. very very helpful post !!! Thanks!!


Avatar for Sharbel
Posted by Sharbel on Wed, 13 June 2007 7:12 am

I ran into this issue due to the src of the (for flash object) was referring to the codebase and plugin through http. In IE, this would trip it up, but firefox handled it ok… as the user above described, changing it to https will get rid of the error and not cause any issues with the page loading.

BTW, this behaviour is consistent in IE5-7.


Avatar for MG
Posted by MG on Sat, 16 June 2007 12:56 am

Thanks Scott for creating a forum like place for this tiny yet very very annoying issue and providing with a solution.

Thanks to Paul Geerts too for coming up with cleaner approach.


Avatar for Vipin
Posted by Vipin on Tue, 10 July 2007 1:37 am

Hi All,

Thanks a lot for such a nice discussion.
Want to add that I am facing the same problem.
I hvn’t use IFrame or the hardcoded path of images or anything in my code, but I am facing the problem.
Is there any open source tool by which I can check that what unsecure item is causing the problem.
Do anybody have suggession on this.

Many Thanks


Avatar for drew
Posted by drew on Mon, 5 November 2007 9:46 am

I am having the same problem with my website. i used a web.com to set up my website and use a template for my pages which provides no support for this issue. because of the templates i havent had to write hardly any code except or my ads, and site add ons. but i dont have any flash players or anything like that. the “do you want to display the nonsecure items” message started coming up after I inputed RSS feeds into my website. So I assume that might have to do with the problem. How do I go about fixing this?


Avatar for please
Posted by please on Wed, 30 January 2008 5:13 pm

i dont have any iframe or other things in my jsp still my application pop up that nonsecure dialog box…………..please help


Avatar for SfxWolf
Posted by SfxWolf on Fri, 15 February 2008 10:16 pm

For those of you who want to stop the pop-up when it’s on other websites.
Step 1: Go to Tool >> Internet Options
Step 2: Select the “Security” Tab and then click on the “Custom Level” button
Step 3: Scroll down until you see the option: “Display mixed content”. Sect the option “Enable”
Step 4: Click Ok, Then you will get a “Security Warning” pop-up. Click Yes


Avatar for satyaki
Posted by satyaki on Tue, 22 April 2008 5:00 pm

Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you


Avatar for ss
Posted by ss on Thu, 15 May 2008 7:09 am

In a php file where I should include “javascript:false”


Avatar for vijay
Posted by vijay on Fri, 20 February 2009 7:25 am

Thanks a lot. It fixed my security popup with iframe, after putting src attribute as “blank.html”. But that solves only secure site starting with https.

But my code is same for both https and http. So if the site is not secure site, starting with http, I get “Page Not Found” error when using blank.html. Is there any workaround for http sites.

Please let me know..

Thanks


Avatar for many
Posted by many on Tue, 12 May 2009 4:58 am

src=’/blank.jsp’

Add above line in iframe element. Awesome work,


Avatar for _mike909_
Posted by _mike909_ on Tue, 1 September 2009 11:49 pm

I’m using a hidden iframe for control reasons, and was already using the .src attribute for references to a dummy.htm, but during dev found that dummy.htm did not actually need to exist, so I never bothered creating it. All was fine until transfer to live https, when “non-secure” warning started appearing. Fixed when I added an empty dummy.htm.


Avatar for Limerick
Posted by Limerick on Mon, 28 September 2009 9:02 am

Hello All,

I’m going crazy.

My problem does not belong to a website.

In Windows Explorer (and not Internet Explorer) I’ve got this popup each time a right click on .zip file located on my private network.

It only happen with right click on .zip file not located on my computer.

I tried the #50 advice above with Internet Explorer and Intranet feature, and it didn’t solve anything.

Please, help me…. :(

;)

Lim.


Add a comment

Gravatar is used. Email address is required but will not be displayed. Please keep your comment on topic. No spamming and/or bad language. First time poster will be moderated. Scott reserves the right to delete/edit your comments.