javascript - Replace specific part of src attribute into an iframe element -


is there way replace specific part of src attribute iframe element?

i have iframe google blog working on...

<iframe allowtransparency='true' id='reactions-iframe' class='reactions-iframe' expr:src='data:post.reactionsurl'  frameborder='0' name='reactions' scrolling='no'/> 

when blog loads src attribute becomes this...

src="https://www.blogger.com/blog-post-reactions.g?options=%5blike,+dislike%5d&textcolor=%23000000#http://www.blog-name.com/post-name.html" 

so, when blog loads want replace part textcolor=%23000000# textcolor=%23ffffff# example. how can using javascript or jquery?

add onload event iframe:

<iframe allowtransparency='true' id='reactions-iframe' class='reactions-iframe' expr:src='data:post.reactionsurl'  frameborder='0' name='reactions' scrolling='no' onload='changesrc();'/> 

and in changesrc() function execute code change src value:

function changesrc() {      const frame = document.getelementbyid('reactions-iframe');      frame.src = frame.src.replace('textcolor=%23000000#', 'textcolor=%23ffffff#');  }  

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -