简体   繁体   English

如何使用javascript打开div内的网页

[英]How to open a webpage inside a div using javascript

I want to open a webpage main.html , which is located in same directory of index.html . 我想打开一个网页main.html ,它位于index.html同一目录中。

Now using iframe, it is opening but I don't want to use iframe or any other script except Javascript. 现在使用iframe,它正在打开,但是我不想使用iframe或除Javascript之外的任何其他脚本。

Also, I'm using this in Apache Cordova Windows app, so it doesn't allow using iframe or other related ways. 另外,我在Apache Cordova Windows应用程序中使用了此功能,因此不允许使用iframe或其他相关方式。

If you use JQuery use this: 如果使用JQuery使用以下命令:

$.get( "main.html", function( data ) {
  $( "#divID" ).html( data );
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM