【JavaScript】IEの場合のdownload属性の代替

【JavaScript】IEの場合のdownload属性の代替

IEの場合、aタグのdownload属性が効かず、ファイルのダウンロードできなかったため、その代替案についての覚え書きです(Drupalネタではないです)。

download属性

Excelファイルをダウンロードできるように、以下のようなリンクを作成し、ファイルがダウンロードできることを確認していたのですが、


<a download="Test.xlsx" href="/download/Test.xlsx">Test.xlsx</a>

IEの場合、これではダウンロードできないとのことで、その対応結果を以下に記します。

JavaScriptでの対応

ググったところ、JavaScriptで画像をダウンロードしたいの記事によると、JavaScriptを使えば、IEでもリンクからファイルのダウンロードができるとのこと。

上記の記事を参考にして、以下のJavaScriptを記述。


function downloadFile(uri,fileName,id) {

    // IEはdownload属性が効かないので分岐
    if (window.navigator.msSaveOrOpenBlob) {
        let xhr = new XMLHttpRequest();
        xhr.open('GET', uri);
        xhr.responseType = 'blob';
        xhr.onloadend = function() {
            if (xhr.status !== 200) {
                return false;
            }
            window.navigator.msSaveOrOpenBlob(xhr.response, fileName);
        };
        xhr.send();
    } else {
        let link = document.getElementById(id);
        link.href = uri;
        link.download = fileName;
    }
}


HTMLは、以下のように記述を変更し、IEでもファイルをダウンロードできるようになりました。


<a id="download1" href="javascript:void(0);" onclick="downloadFile('/download/Test.xlsx','Test.xlsx','download1');">Test.xlsx</a>

カテゴリー

コメント

Greetings folks! Just wished to make known myself—I'm the delighted owner of a fresh drywall repair company centered in shoreline homes here in California. 🌊 Whether you're managing with ruin from the salty air or just in demand of some ordinary repairs, my team and I are here to help. We comprehend the unique challenges that come with living by the ocean, and we're committed to providing solutions that stand the test of time. So if you're a homeowner in search of some drywall expertise, look no further! Let's work together to keep those walls seeming their best. 🏠
名前
JoesphHet
Securing the safety of your business is vital in today's fierce marketplace. One of the best ways to secure your company resources and financial documents is by investing in a dependable commercial safe. Whether or not you're keeping money, crucial records, or confidential data, a safe provides an essential layer of protection for your business.

When selecting a safe for commercial use, there can be multiple factors to consider. First and foremost, appraise your company's protection necessities. Determine what items demand safeguarding and the degree of safety required.

Following, factor in the size and type of safe required for your company. Opt for a safe which fits within the limits of your business's room while supplying satisfactory space for valuables. Take into account whether or not the safe needs supplementary attributes such as fire resistance or waterproofing.

Additionally, examine the protective elements of the safe. Search for features such as sophisticated locking mechanisms, robust construction, and manipulation resistance. Consider investing in a safe with added security measures such as fingerprint scanners or electronic keypads.

Lastly, guarantee the safe fits within the limits of your enterprise's budget. Set a reasonable budget based on your protection necessities and investigate alternatives that match within your monetary constraints.

To conclude, choosing the right safe for your business is vital for securing your assets. By appraising your safety requirements, taking into account the dimensions and kind of safe needed, inspecting protective elements, and fixing a budget, you can ensure maximum protection for your business.

Professional consultation for residential security boxes in Scottsdale - https://mercurylock.com/services
名前
KarenCef
Securing the aid of a disability attorney for claims related to disabilities in Albuquerque carries great value. Those who seek the support of a attorney for disabilities in trials regarding disabilities can derive innumerable benefits and priceless support during the disability claims process. These attorneys retain the required competencies, wisdom, and proficiency to successfully traverse the intricacies of the legal system and advocate for their clients' best benefits.

One of the principal roles of a lawyer for disabled individuals in court proceedings related to disabilities involves adeptly guiding and managing the legal proceedings. Attorneys specializing in disabilities shine at navigating the complexities of court proceedings on disabilities, which can be intimidating for those unfamiliar with the judicial system. By employing the aid of a disability attorney, individuals with disabilities significantly boost their chances of success in court for disability claims.

Throughout disability claims court proceedings, a disability attorney plays a pivotal and engaged role in offering essential support. They actively collaborate with clients in drafting and filing claims applications for disabilities, petitions, and appeals, streamlining the process and ensuring all required documentation is precisely presented. Additionally, attorneys specializing in disabilities provide vital assistance during disability court trials, utilizing their expert understanding of laws pertaining to disabilities and guidelines to supply guidance, advice, and strategic representation.

The advantages of securing a attorney specializing in disabilities for disability claims are diverse. These attorneys supply specialized guidance and recommendations, arming their clients with a advantage in court proceedings related to disabilities. Through their comprehensive knowledge of the lawful environment, attorneys specializing in disabilities can efficiently traverse the complicated structure of regulations and laws governing claims related to disabilities, ensuring that their clients' rights are secured and their best interests are spoken for.

Moreover, lawyers for disabled individuals facilitate the procedure for disability claims, relieving the load on individuals with disabilities. They serve as champions, liaising with government agencies, insurance providers, and other pertinent entities on behalf of their clients. This complete support allows individuals with disabilities to focus on their well-being and private affairs, being informed that their claims related to disabilities are being handled with utmost care and attention to detail.

In the setting of disability claims in Albuquerque region, it is crucial to realize the unique expertise provided by lawyers focused on social security. These lawyers focus on social security laws and regulations, making them highly valuable resources for individuals seeking social security disability entitlements. Social security lawyers retain thorough knowledge of the detailed regulations and protocols governing social security disability claims, enabling them to provide tailored recommendations and guidance to their clients.

By acquiring a lawyer for disabled individuals, individuals with disabilities have access to a abundance of resources and aid. These lawyers serve as dedicated champions, persistently advocating for their clients' claims and privileges. Lawyers for disabled individuals grasp the obstacles faced by individuals with disabilities and strive to ensure they receive the benefits for disabilities they are entitled to.

In conclusion, the decision to secure a lawyer for disabled individuals is a vital one for individuals with disabilities pursuing disability benefits in the city of Albuquerque. These attorneys play a vital part in streamlining the legal system, maximizing the chances of success in trials regarding disabilities, and providing specialized guidance and recommendations tailored to their clients' unique circumstances.

<a href=https://www.disabilityalbuquerque.com>Function of a disability retirement lawyer in securing pension benefits</a>
名前
HenryInvit




Licensed Roofing Experts in Wilmington NC

Dwelling near the seaside offers many rewards: ocean breezes, stunning views and the distinct noise of surf hitting on the shore are some of them. However, residing there also brings unique challenges: gusts, showers and the persistent salty air can damage roofing causing seepage, liquid infiltration and potentially mildew growth below tiles, thus necessitating employing a professional roofer in Wilmington North Carolina to resolve these problems properly. That is why maintaining access to reliable roofing contractors professionals in Wilmington North Carol is vital!

Roofers accredited with the State of NC can evaluate likely concerns and take precautionary actions to keep rooftops in good shape - this could save expenses in corrections while offering a safer residential area or job site for inhabitants or workers.

These businesses specialize in residential and industrial roof work such as metal roof fittings, spray foam roofing, cool roof coating applications, roof covering repair methods, complete replacements of both home and industrial roofs and upkeep services. Additionally, they can take care of setups for residential associations to meet regulations.

Roof experts licensed in Wilmington NC must carry coverage and bond coverage when doing roofing at homes and businesses, to safeguard residents against possible harm that may take place during a job and make certain their rooftop is repaired or replaced by qualified experts. Moreover, it aids the homeowner validate whether their selected authorized roofer has the experience and ability to deliver top-notch services.







<a href=https://portcityexteriors.com/concrete-services/>Roofing strengthening choices near me in Wilmington North Carolina</a>

<a href=http://www.lgfsysmac.com/blogs/>Importance of Roofing Maintenance Plans</a> e646ddc
名前
LouieClear




How to Care for Building Materials

Maintaining the elements used in your tasks is crucial to making them stay functional. Whether you’re using wood, stone, metal, or other elements, knowing how to correctly maintain them can help you avoid spending time and money in the long run.

For wood components, especially outdoors, regular upkeep and sealing are vital to preserving them from water and rot. Applying a wood cleaner and covering with sealant every few years will assist the life of decks, fences, or wooden furniture. Keeping away from direct contact with soil or standing water can also avoid decay over time.

Stone components, like pavers or pathways, may look durable, but they still call for attention. Regular hosing down and hosing off dirt can help them clean, and sealing the stone can prevent cracking or fading from sun exposure. For moss buildup, a mild cleaner and brush can get them to look clean again.

Metal, commonly employed in outdoor furniture or fixtures, can rust if not properly cared for. Regularly applying a protective coating or using rust-proof paint can keep metal in strong condition. For smaller items, just brushing them off and storing them during harsh weather can prevent corrosion.

By spending a little time to preserve these resources, you can make sure that your endeavors stay good-looking and usable for years to come. Regular upkeep, along with using quality components, will help avoid you from needing to make costly repairs or replacements later on.

<a href=http://www.creativecompulsions.com/request-a-free-quote/>Creating step treads: ideas and layout inspiration.</a> c11c03_

<a href=https://americanstoneandtimber.com/specials>Fieldstone paver setup manual</a>
名前
RonaldAcima
Living in Orange County or every coastal city close to the ocean provides countless perks, nonetheless it also poses unique challenges. One particular challenge involves the potential harm due to moisture and humidity towards the drywall within our homes. In this blog post, we will investigate the significance of timely drywall repair and discuss the specifically targeted considerations for homeowners in Orange County and other coastal cities. By understanding the risks and taking proactive measures, residents can guarantee the longevity and structural integrity of their homes.

Grasping the Impact of Moisture on Drywall
Drywall, a standard building material employed in interior walls and ceilings, is prone to moisture damage. In coastal areas, the closeness towards the ocean increases the risk as a result of higher humidity levels and occasional moisture intrusion from the salty air. When moisture filters into drywall, it may result in various issues, including:
Fungus and Mildew Growth: Excess moisture creates a perfect environment for mildew and mold to thrive, endangering indoor quality of air and posing health problems.
Structural Weakness: Wet drywall weakens and loses its structural integrity, potentially resulting in sagging, cracks, or even collapse.
Aesthetic injury: humidness damage often occurs in nasty marks, bubbling, ripping paint, and texture decline, lowering the visual appeal of your house.

Quick Drywall Repair: Fighting More Pain
Repairing drywall quickly is crucial to prevent more harm and reduce restoration prices. Postponing repairs can exacerbate provide challenges, leading to much more intensive and high priced restorations. Take into account the next reasoned explanations why prompt drywall servicing is essential:
Mold Mitigation: dealing with moisture-related issues promptly blocks fungus advancement and growth, ensuring your loved ones's health.
Preserving Architectural Sincerity

: restoring battered drywall assures the consistency and protective of your house, evading capacity hazards.
Reducing alternate Damage: Humidity-affected drywall can impact abutting materials such as insulation and solid wood framing. By repairing drywall quickly, you can avoid additional damage and relevant repairs.
Cost Efficiency: Early detection and repair of drywall issues are much more cost-effective than waiting until the damage comes to be dangerous. Appropriate problems preserve you from widespread building work as well as interested evacuation costs.

Methods for Drywall Routine Maintenance in Shore Parts
Living close to the beach demands added attention and care to maintain the reliability of your drywall. Check out practical methods for residents in OC and resort metropolitan areas:
Typical Assessments: Conduct typical visual review of one's drywall, being attentive to signs of water damage, such as for instance staining, cracking painting, or delicate blemishes.
Working with water: Use dehumidifiers or air conditioners to control interior water quantities, especially for the duration of monsoon times.
Guaranteeing air-flow: Make sure appropriate air-flow in bath rooms, dining rooms, as well as other areas susceptible to moisture content build-up. Install and keep exhaust system fans to remove extra moisture content.
Regularly holding the surface: Consistently look over your house's facade, such as the roof top, gutters, and windows, to spot and manage any interested aspects of moisture entrance.
Resolving plumbing work water leaks: Resolve any plumbing leaks rapidly to avoid water from leaking in to the wall structures and bringing about drywall hurt.
Professional help: Hire savvy building contractors for complete assessments and problems to correct any established or promising drywall pitfalls.

Summation
In shore avenues like Orange County, prompt drywall recovery is essential to alleviate the harmful aftereffects of moisture and dampness. By grasping the risks related to wetness damage and embracing hands-on actions, household owners know how to guarantee the long lifespan, protection, and aesthetic selling point of their unique residential homes.

I value greatly the uncovering of this site because of its wealth of valuable knowledge and factual content. The site has demonstrated to be an indispensable tool, supplying crucial knowledge on a variety of subjects. Its comprehensive collection of facts has made it an crucial tool for investigation, education, and staying informed. I am captivated by the site's dedication to accuracy and dependability, ensuring that readers can trust the data they find. I am eager about endorsing this site to my buddies, as it offers a distinctive opportunity to explore and gain a plethora of knowledge easily. I recommend them to explore <a href=https://drywallpatchguys.com/best-drywall-repair-water-restoration-services-dana-point-ca/>Restoration services in Aliso Viejo CA</a> and discover the multitude of ideas it has to offer.
<a href=https://drywallpatchguys.com/drywall-repair-services-water-restoration-in-laguna-hills-ca/>Irvine CA Perfect Drywall</a>
<a href=http://www.drops.com/>Determine of Drywall Renovation on Kitchen Resale Market Value</a> 0a4ee64
名前
FrancisEmela
High-pressure washing plays a vital role in enhancing the look and cleanliness of parking lots and parking lots. Consistent power washing washes away oil stains, debris, and garbage, enhancing the overall appearance and safety of these zones. A clean parking area offers a good impression for clients and customers, giving a good impression on the establishment or property. Moreover, cleaning dirt and stains helps avoid wear to the pavement and increase its longevity. Tidy and well-maintained lots are also not as likely to attract pests and pests. By investing in pressure cleaning, facility operators will ensure that their parking lots remain appealing, safe, and in good condition. If you're keen, feel free to check out my home and business high-pressure washing services website to discover more.

<a href=https://calipressurewashing.net/?et_blog>Commercial Solar Panel Steam cleaning near Brentwood for realtors</a>

<a href=http://radiocorp.nl/>Creating a Cleaner Environment for Industrial Settings</a> 02_e140
名前
MichaelWem

コメントを追加

CAPTCHA
この質問はあなたが人間の訪問者であるかどうかをテストし、自動化されたスパム送信を防ぐためのものです。
画像CAPTCHA
画像内に表示されている文字列を入力してください。