javascript - svg xlink:href not updating dynamically on ios broswer(chrome /safari) and safari desktop -


i added onclick event these images , on image click, svg xlink:href supposed dynamically changed. changes on pc (all browsers except safari), changes on android, not on browser on ios or macosx.

this html

        <main>         <content>           <section class="row story-images" id="stage-1">             <div class="col-md-2 col-sm-3 col-xs-4 col-xxs-6">                 <img src="http://placehold.it/200x200" class="img-center" onclick="addimagestoarray(this)"/>             </div>             <div class="col-md-2 col-sm-3 col-xs-4 col-xxs-6">                 <img src="http://placehold.it/400x400" class="img-center" onclick="addimagestoarray(this)"/>             </div>         </section>         <section class="row" id="stage-2">             <div class="col-md-6 svg-holder">                 <svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"  viewbox="0 0 1300 1300" style="enable-background:new 0 0 1300 1300;" xml:space="preserve"> <style type="text/css">     .st0{fill:#0c3e4c;}     .st1{fill:#bcbec0;stroke:#ffffff;stroke-width:5;stroke-miterlimit:10;}     .st2{fill:#bcbec0;}     .st3{fill:#ffffff;}     .st4{font-family:'oswald-extra-lightitalic';}     .st5{font-size:54.8244px;} </style> <rect class="st0" width="1014.6" height="1014.6"/> <!--<rect x="71" y="142.6" class="st1" id="one" width="262.5" height="262.5"/>--> <image x="71" y="142.6" class="st1" id="2" width="262.5" height="262.5" xlink:href="http://placehold.it/262x262" /> <image x="342.5" y="192.4" class="st1" id="3" width="262.5" height="262.5" xlink:href="http://placehold.it/262x262" /> <image x="597.8" y="142.6" class="st1" id="4" width="290.7" height="290.7" xlink:href="http://placehold.it/97x90" /> <image x="116.1" y="577.8" class="st1" id="5" width="357.6" height="357.6" xlink:href="http://placehold.it/262x262" /> <image x="282.8" y="421" class="st1" id="6" width="262.5" height="262.5" xlink:href="http://placehold.it/262x262" /> <image x="491.2" y="477" class="st1" id="7" width="428.8" height="428.8" xlink:href="http://placehold.it/262x262" /> 

and javascript

    var counter = 1;      function addimagestoarray(element){         if(counter < 6){              convertimgtobase64(element.src, function(base64img){ document.getelementbyid(counter).setattributens('http://www.w3.org/1999/xlink', 'xlink:href', base64img);            });             counter++;         }else if(counter == 6){              convertimgtobase64(element.src, function(base64img){ document.getelementbyid(counter).setattributens('http://www.w3.org/1999/xlink', 'xlink:href', base64img);         });             counter++;        }     }      function convertimgtobase64(url, callback, outputformat) {       var img = new image();       img.crossorigin = 'anonymous';       img.onload = function() {         var canvas = document.createelement('canvas');         var ctx = canvas.getcontext('2d');         var dataurl;         canvas.height = this.height;         canvas.width = this.width;         ctx.drawimage(this, 0, 0);         dataurl = canvas.todataurl(outputformat);         callback(dataurl);         canvas = null;       };       img.src = url;     } 

is there configuration ios i'm supposed regarding dynamically manipulating svg files?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -