CN107122227A - A kind of picture method for down loading based on JavaScript front ends script - Google Patents

A kind of picture method for down loading based on JavaScript front ends script Download PDF

Info

Publication number
CN107122227A
CN107122227A CN201710236256.6A CN201710236256A CN107122227A CN 107122227 A CN107122227 A CN 107122227A CN 201710236256 A CN201710236256 A CN 201710236256A CN 107122227 A CN107122227 A CN 107122227A
Authority
CN
China
Prior art keywords
picture
download
javascript
client
service end
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710236256.6A
Other languages
Chinese (zh)
Inventor
詹仙鸿
徐品
陈建灵
陈铎
吴佳雨
高锦云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Xinghai Communication Technology Co Ltd
Original Assignee
Fujian Xinghai Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Xinghai Communication Technology Co Ltd filed Critical Fujian Xinghai Communication Technology Co Ltd
Priority to CN201710236256.6A priority Critical patent/CN107122227A/en
Publication of CN107122227A publication Critical patent/CN107122227A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser

Abstract

The present invention provides a kind of picture method for down loading based on JavaScript front ends script, need to provide and one section of JavaScript script for download pictures is implanted into client and service end, the service end, methods described:Step 1, browser load the data and picture of webpage to client from service end, and the data include the JavaScript scripts;Step 2, when triggering picture download function, judged by the JavaScript scripts with the presence or absence of correspondence picture in client-cache, if so, then into step 3, otherwise into step 4;Whether step 3, the core type for judging the browser are IE kernels, if so, then obtaining IE download pictures store method carries out picture down operation, terminate flow, otherwise, obtain non-IE download pictures store method and carry out picture down operation, terminate flow;Step 4, prompting user's picture are not present.Picture method for down loading of the present invention, improves picture download efficiency and security, lifts Consumer's Experience.

Description

A kind of picture method for down loading based on JavaScript front ends script
Technical field
Downloaded the present invention relates to computer realm, more particularly to a kind of picture based on JavaScript front ends script Method.
Background technology
Carried out at present in the mainstream technology of page download picture using service end instruction, when needing download pictures, Client is connected by being set up with service end, from service end download pictures, and this use service end carries out picture download function, fits For the browser of different kernels, but the load of server can be increased, reduce speed of download, and the leakage of increase picture downloading process Hole and the chance by assault.In addition, existing browser mainly has IE kernels and non-IE kernels two this kind of, directly use JavaScript front ends script download pictures can have the browser-incompatible of some versions, it may appear that Yong Hudian When hitting download pictures button, download button click on can not download pictures serious consequence, and because the method for download pictures is slow In the browser that there is subscription client, when user network communication goes wrong, the picture of breakage, picture are easily downloaded to Download efficiency is low.
The content of the invention
The technical problem to be solved in the present invention, is to provide under a kind of picture based on JavaScript front ends script Support method, improves picture download efficiency, improves the security that picture is downloaded, and lifts Consumer's Experience.
What the present invention was realized in:A kind of picture method for down loading based on JavaScript front ends script, need to be carried For client and service end, one section of implantation is used for the JavaScript scripts of download pictures, methods described bag in the service end Include following steps:
Step 1, browser load the data and picture of webpage to client from service end, and the data include described JavaScript scripts;
Step 2, when triggering picture download function, by the JavaScript scripts judge in client-cache whether In the presence of correspondence picture, if so, then entering step 3, otherwise into step 4;
Whether step 3, the core type for judging the browser are IE kernels, are preserved if so, then obtaining IE download pictures Method carries out picture down operation, terminates flow, otherwise, obtains non-IE download pictures store method and carries out picture down operation, Terminate flow;
Step 4, prompting user's picture are not present.
Further, the step 2 is specially:Clicked on webpage after picture download button, trigger picture download function, Press the incoming picture path of the button or ID values go to obtain the path of the picture, by judging whether the picture path has Imitate to judge in client-cache with the presence or absence of correspondence picture.
The invention has the advantages that:By being implanted into a JavaScript scripts in service end, using the script from client Download pictures needed for being obtained in end, rather than from service end download pictures, without being interacted again with service end, it is to avoid may The problem of because of the leak of picture download by assault, the performance of user's client machine is fully called, systematicness is improved Can, picture speed of download is improved, Consumer's Experience is lifted.
Brief description of the drawings
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is a kind of picture method for down loading execution flow chart based on JavaScript front ends script of the present invention.
Embodiment
As shown in figure 1, a kind of picture method for down loading based on JavaScript front ends script of the present invention, need to provide visitor One section is implanted into family end and service end, the service end is used for the JavaScript scripts of download pictures, and methods described is included such as Lower step:
Step 1, browser load the data and picture of webpage to client from service end, and the data include described JavaScript scripts;
Step 2, when triggering picture download function, by the JavaScript scripts judge in client-cache whether In the presence of correspondence picture, if so, then entering step 3, otherwise into step 4;
Whether step 3, the core type for judging the browser are IE kernels, are preserved if so, then obtaining IE download pictures Method carries out picture down operation, terminates flow, otherwise, obtains non-IE download pictures store method and carries out picture down operation, Terminate flow;
Step 4, prompting user's picture are not present.
In the present invention, the step 2 is specially:Clicked on webpage after picture download button, trigger picture download function, Press the incoming picture path of the button or ID values go to obtain the path of the picture, by judging whether the picture path has Imitate to judge in client-cache with the presence or absence of correspondence picture.
The inventive method is described further with reference to a specific embodiment:
When user browses webpage by browser, data and picture of the webpage etc. can be loaded on the page, taken Business has one section of JavaScript script to be also loaded into the lump in webpage in end, completes a network between service end and client Communication, download pictures may be needed when user is browsing webpage, and now user clicks on download button, will trigger download Picture function, JavaScript scripts can judge that user needs the picture downloaded to be which is opened in subscription client, and picture is No presence etc. is basic to be judged, the path that can specifically remove to obtain picture by the incoming picture path of download button or ID values passes through Judge the validity in picture path determine in client with the presence or absence of correspondence picture, even picture path effectively, then in the presence of pair Answer picture, recycle JavaScript scripts to judge whether browser is IE kernels, can specifically use if (!! Window.ActiveXObject | | " ActiveXObject " in window) method judges the core type of browser, if For IE kernels, then the method that IE kernel download pictures are stored in subscription client is directly invoked, if non-IE kernels (Google, fire The kernel of the browsers such as fox is not IE kernels), then directly invoke the side that non-IE kernels download pictures are stored in subscription client Method, if picture path is invalid, in the absence of correspondence picture, points out user not have picture, will be without the Downloadable information of effective picture Feed back to user, it is to avoid user is clicked on after download pictures because the ineffectivity of picture cannot be fed back and repeatedly be clicked on The problem of, improve the experience of user.
The present invention carries out picture and downloads the Effective judgement operation for preserving operation and picture on the client, alleviates clothes The pressure at business end, improves picture download efficiency, also avoids the safety issue repeatedly occurred with service end interactive correspondence, the present invention Increase the feedback interface of picture ineffectivity, improve friendly, browser compatibility operation is carried out by JavaScript scripts, with Just realize that download of the different browsers to picture is preserved to operate, improve treatment effeciency of the browser to picture, improve user under The fulfillment capability of picture function is carried, Consumer's Experience is improved.
Although the foregoing describing the embodiment of the present invention, those familiar with the art should manage Solution, the specific embodiment described by us is merely exemplary, rather than for the restriction to the scope of the present invention, is familiar with this The equivalent modification and change that the technical staff in field is made in the spirit according to the present invention, should all cover the present invention's In scope of the claimed protection.

Claims (2)

1. a kind of picture method for down loading based on JavaScript front ends script, it is characterised in that:Need to provide client and One section is implanted into service end, the service end is used for the JavaScript scripts of download pictures, and methods described comprises the following steps:
Step 1, browser load the data and image cache of webpage to client from service end, and the data include described JavaScript scripts;
Step 2, trigger picture download function when, judge to whether there is in client-cache by the JavaScript scripts Correspondence picture, if so, then entering step 3, otherwise into step 4;
Whether step 3, the core type for judging the browser are IE kernels, if so, then obtaining IE download pictures store methods Picture down operation is carried out, terminates flow, otherwise, non-IE download pictures store method is obtained and carries out picture down operation, terminate Flow;
Step 4, prompting user's picture are not present.
2. a kind of picture method for down loading based on JavaScript front ends script according to claim 1, its feature It is:The step 2 is specially:Clicked on webpage after picture download button, trigger picture download function, pressed the button and pass The picture path or ID values entered go to obtain the path of the picture, by judging whether the picture path effectively judges client With the presence or absence of correspondence picture in the caching of end.
CN201710236256.6A 2017-04-12 2017-04-12 A kind of picture method for down loading based on JavaScript front ends script Pending CN107122227A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710236256.6A CN107122227A (en) 2017-04-12 2017-04-12 A kind of picture method for down loading based on JavaScript front ends script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710236256.6A CN107122227A (en) 2017-04-12 2017-04-12 A kind of picture method for down loading based on JavaScript front ends script

Publications (1)

Publication Number Publication Date
CN107122227A true CN107122227A (en) 2017-09-01

Family

ID=59726333

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710236256.6A Pending CN107122227A (en) 2017-04-12 2017-04-12 A kind of picture method for down loading based on JavaScript front ends script

Country Status (1)

Country Link
CN (1) CN107122227A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704785A (en) * 2019-10-11 2020-01-17 胥万福 Data processing method for rapidly opening pictures in webpage through Photoshop
CN110912984A (en) * 2019-11-20 2020-03-24 四川商通实业有限公司 Multi-format file downloading method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172694A1 (en) * 2008-01-02 2009-07-02 Sandisk Il Ltd. Cache management
CN104036011A (en) * 2014-06-24 2014-09-10 北京奇虎科技有限公司 Webpage element display method and browser device.
CN104461515A (en) * 2014-11-23 2015-03-25 国云科技股份有限公司 Method for caching jsp page images
CN102438045B (en) * 2011-12-07 2015-07-08 深圳市深信服电子科技有限公司 Method and system for pre-fetching web page, and method for accessing web page
US9542370B2 (en) * 2012-08-30 2017-01-10 Alticast Corporation Method and apparatus for sharing JavaScript object in webpages

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172694A1 (en) * 2008-01-02 2009-07-02 Sandisk Il Ltd. Cache management
CN102438045B (en) * 2011-12-07 2015-07-08 深圳市深信服电子科技有限公司 Method and system for pre-fetching web page, and method for accessing web page
US9542370B2 (en) * 2012-08-30 2017-01-10 Alticast Corporation Method and apparatus for sharing JavaScript object in webpages
CN104036011A (en) * 2014-06-24 2014-09-10 北京奇虎科技有限公司 Webpage element display method and browser device.
CN104461515A (en) * 2014-11-23 2015-03-25 国云科技股份有限公司 Method for caching jsp page images

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ROBERT NYMAN: "Storing images and files in IndexedDB", 《HTTPS://HACKS.MOZILLA.ORG/2012/02/STORING-IMAGES-AND-FILES-IN-INDEXEDDB/》 *
欧永红,姚耀文: "一种基于IE缓存的Web图像获取方法", 《计算机系统应用》 *
终日乾坤: "js保存图片到本地", 《HTTPS://MY.OSCHINA.NET/U/2462382/BLOG/753364》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704785A (en) * 2019-10-11 2020-01-17 胥万福 Data processing method for rapidly opening pictures in webpage through Photoshop
CN110912984A (en) * 2019-11-20 2020-03-24 四川商通实业有限公司 Multi-format file downloading method and system

Similar Documents

Publication Publication Date Title
CN103856446B (en) A kind of login method, device and open platform system
CN104935491A (en) Method and device for transmitting expression image
US8458612B2 (en) Application management framework for web applications
US20200012770A1 (en) System, apparatus, and method of collecting and processing data in electronic devices
US20140100963A1 (en) Method, System and Device For Filtering Mobile Terminal Webpage Advertisements
WO2020253366A1 (en) Webpage mailbox data crawling method and apparatus, terminal, and storage medium
WO2015153925A1 (en) Processing requests to access content
CN105243407B (en) Read and write the method and device of smart card
CN102930211A (en) Method for intercepting malicious URLs in multi-kernel browser and multi-kernel browser
CN102323880A (en) Mobile phone application interface development method and terminal based on browser parsing mode
CN104615771B (en) A kind of method and device obtaining web data
CN104504060A (en) File downloading method in browser, browser client side and device
CN102185915A (en) Mobile device and webpage loading method thereof
CN107122227A (en) A kind of picture method for down loading based on JavaScript front ends script
CN103607454B (en) The method that android system browser arranges privately owned proxy server
CN105955714A (en) Mixed development front end MVC frame implementation method and system
CN106599270A (en) Network data capturing method and crawler
CN106528118A (en) Method for solving compatibility of modal and non-modal windows in browser
US10789751B2 (en) Method and apparatus for implementing animation in client application and animation script framework
WO2017092455A1 (en) Method for web browsing in mobile terminal, and mobile terminal
CN103905477B (en) A kind of method and server for handling HTTP request
CN112764746B (en) Data processing method, device, electronic equipment and storage medium
CN113609417A (en) Method, device, equipment and medium for processing mobile terminal page
CN107341234A (en) Display methods, device and the computer-readable recording medium of the page
EP2291779A1 (en) Method of generating a document from a web server located in a portable electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170901

WD01 Invention patent application deemed withdrawn after publication