---
title: "indow.frames[\"Iframe1\"].document.location兼容问题"
author: "Charles+java"
date: "2013-04-10T17:50:21Z"
tags: []
categories: ["Web前端"]
slug: "indow-frames-iframe1-document-location"
draft: false
lastmod: "2013-04-10T17:50:21Z"
id: 1845279
url: "https://doing.iteye.com/blog/1845279"
---

window.frames.document.location兼容问题

 

在ie中使用window.frames.document.location="";无任何问题，可在谷歌中出现location未定义错误

其真正原因还在浏览器的内核不一样，参照：http://blog.csdn.net/lzy_1515/article/details/6045629

所以将iframe的id和name设成一样的即可

<iframe frameborder="0" id="Iframe1" name="Iframe1" scrolling="yes" src="/maintenance/vehicle/EvaluationImgUrl.aspx"
                        style="visibility: inherit; width: 319px; z-index: 1; height: 350px;"></iframe>