Home Web Front-end JS Tutorial Remote calling jquery.js in a js file will cause a strange problem under ie8_javascript skills

Remote calling jquery.js in a js file will cause a strange problem under ie8_javascript skills

May 16, 2016 pm 06:15 PM
remote call

Copy code The code is as follows:

function include(path){
var a=document.createElement ("script");
a.type = "text/javascript";
a.src=path;
var head=document.getElementsByTagName("head")[0];
head .appendChild(a);
}
include("http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js")

Like this You call the script under IE8. After pressing Enter in the IE8 address bar, there is no problem in calling jquery objects, methods, etc., but there will be problems after refreshing. After refreshing, you have to press Enter in the address bar no matter what.
There is no problem under Firefox. Attached is an html script of window.name, you can test it:
Copy the code The code is as follows:




Demo:Cross-domain
< ;meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script> <br>function include(path){ <br>var a=document .createElement("script"); <br>a.type = "text/javascript"; <br>a.src=path; <br>//if (a.readStatus == 200) { <br>var head =document.getElementsByTagName("head")[0]; <br>head.appendChild(a); <br>//} <br>} <br>include("http://jqueryjs.googlecode.com/files /jquery-1.3.2.min.js") <br></script>
<script> <br>$(function(){ <br>function sendData(url, callback){ <br> if(!url || typeof url !== 'string'){ <br>return; <br>} <br>url = (url.indexOf('?') > 0 ? '&' : '?' ) 'windowname=true'; <br>var frame = $('<iframe style="display:none;"></iframe>').appendTo("body"); <br>var state = 0; <br>var clear = function(){ <br>try{ <br>frame[0].contentWindow.document.write('');//Clear the content of iframe <br>frame[0].contentWindow .close();//Avoid iframe memory leaks<br>frame.remove();//Delete iframe <br>}catch(e){} <br>}; <br>var getData = function(){ <br>try{ <br>var data = frame[0].contentWindow.name; <br>}catch(e){} <br>clear(); <br>if(callback && typeof callback === 'function '){ <br>callback(data); <br>} <br>}; <br>frame.bind('load', function(){ <br>if(state === 1){ <br> getData(); <br>} else if(state === 0){ <br>state = 1; <br>frame[0].contentWindow.location = "none.html"; <br>} <br> }); <br>frame[0].src = url; <br>} <br>//Application: <br>var testurl = 'http://www.jb51.cn/test.html'; <br>$("button").click(function(){ <br>sendData( testurl ,function(result){ <br>var fishDiv = $("#oldFish"); <br>fishDiv.html( "You get The data is: " result ); <br>}) <br>}) <br>}) <br></script>


< ;button>Load data remotely

Dev By < ;a href="http://www.jb51.cn" >Material download & Hua


Reference :Script Home




Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to handle remote calls and remote procedure calls in C# development How to handle remote calls and remote procedure calls in C# development Oct 09, 2023 am 09:37 AM

How to handle remote calls and remote procedure calls in C# development requires specific code examples. Introduction: With the rapid development of cloud computing and distributed systems, remote calls and remote procedure calls (RemoteProcedureCall, RPC for short) are becoming more and more important in software development. The more important it is. As a powerful programming language, C# also provides some powerful tools and frameworks for handling remote calls and RPC. This article will give some practical code examples on how to handle remote calls and RPC. 1. Remote calling

How to implement RPC remote calling in PHP? How to implement RPC remote calling in PHP? May 11, 2023 pm 11:51 PM

With the rapid development of the Internet and the widespread application of cloud computing technology, distributed systems and microservice architectures are becoming more and more common. In this context, remote procedure call (RPC) has become a common technical means. RPC can enable different services to be called remotely on the network, thereby realizing interconnection operations between different services and improving code reusability and scalability. As a widely used Web development language, PHP is also commonly used in the development of various distributed systems. So, how to implement RPC remote debugging in PHP?

How to implement remote calling and interactive operation of data in MySQL? How to implement remote calling and interactive operation of data in MySQL? Aug 02, 2023 pm 12:48 PM

MySQL is a relational database management system that is widely used in various software development and data management scenarios. One of its important features is that it can realize remote calling and interactive operations of data. This article will introduce how to implement this function in MySQL and provide corresponding code examples. MySQL provides a feature called MySQL remote connections that allows data exchange between different machines. In order to achieve remote connection, we need to perform the following steps: Configuring the MySQL server First, we need to ensure

Using Thrift to implement cross-language remote procedure calling and communication in PHP Using Thrift to implement cross-language remote procedure calling and communication in PHP Jun 25, 2023 pm 04:38 PM

As applications become more complex and distributed, cross-language remote procedure calls (RPC) and communication become increasingly important. In software development, RPC refers to the technology that enables different programs or processes to communicate with each other over the network. Thrift is a simple and easy-to-use RPC framework that can help us quickly develop efficient cross-language RPC services. Thrift was developed by Facebook and is an efficient remote service invocation protocol. It supports multiple languages, including PHP, Java, Python

RPC in PHP RPC in PHP May 26, 2023 am 09:03 AM

In recent years, with the rapid development of Internet technology, distributed systems have gradually become an indispensable part of the Internet application field. RPC technology in distributed systems is one of the important means to achieve communication between different processes and machines. Among them, RPC technology in PHP has gradually become one of the most widely used technologies among major Internet companies. RPC (RemoteProcedureCall) refers to remote procedure call, which is implemented through remote call on different processes or different machines.

How to perform remote calling and module expansion in PHP? How to perform remote calling and module expansion in PHP? May 20, 2023 pm 01:40 PM

PHP is a scripting language widely used in Web development. It has a large community and rich resources, and can easily realize the development of dynamic Web pages and data interaction. However, in actual development, it may be necessary to remotely call other services or extend the PHP module to achieve more functions and performance optimization. This article will introduce how to make remote calls and module extensions in PHP. 1. PHP remote calling In actual development, we may need to make remote calls to other services, such as calling the API of other Web services, calling remote

How to implement a simple RPC remote procedure call framework in Python How to implement a simple RPC remote procedure call framework in Python Oct 27, 2023 am 09:57 AM

How to implement a simple RPC remote procedure call framework in Python. In distributed systems, a common communication mechanism is to implement function calls between different processes through RPC (RemoteProcedureCall, remote procedure call). RPC allows developers to call remote functions just like calling local functions, making distributed system development more convenient. This article will introduce how to use Python to implement a simple RPC framework and provide detailed code examples. 1. Define RPC

What are the implementation methods of remote calling in PHP7.0? What are the implementation methods of remote calling in PHP7.0? May 26, 2023 pm 08:01 PM

What are the implementation methods of remote calling in PHP7.0? Remote calling refers to calling a program or service in another computer system from one computer system so that these systems can interact and collaborate transparently. In web applications or distributed systems, remote calling is one of the most common technical means. Through remote calling, different systems can be easily integrated to achieve more complex application functions. In PHP7.0, there are many ways to implement remote calls. The following is a brief introduction to some common implementation methods.

See all articles