1"use strict";(self.webpackChunkinappweview_website=self.webpackChunkinappweview_website||[]).push([["1849"],{5124:function(e,t,i){i.r(t),i.d(t,{assets:function(){return p},contentTitle:function(){return o},default:function(){return u},frontMatter:function(){return s},metadata:function(){return n},toc:function(){return l}});var n=i(5786),r=i(5893),a=i(65);let s={slug:"webview-javascript-injection-with-user-scripts-flutter-inappwebview-6",title:"Injecting JavaScript in Flutter Web View With User Scripts",image:"article-banner.webp",date:new Date("2022-11-28T22:00:00.000Z"),authors:["lorenzo"],tags:["inappwebview","webview","user-script","user-scripts","javascript"]},o=void 0,p={authorsImageUrls:[void 0]},l=[];function c(e){let t={a:"a",img:"img",p:"p",...(0,a.a)(),...e.components},{Head:n}=t;return!n&&function(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Head",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n,{children:(0,r.jsx)("link",{rel:"canonical",href:"https://betterprogramming.pub/webview-javascript-injection-with-user-scripts-flutter-inappwebview-6-46d9969353a4"})}),"\n",(0,r.jsx)(t.p,{children:"Learn how to leverage Flutter's InAppWebView 6 plugin"}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{alt:"article-banner.webp",src:i(254).Z+"",width:"720",height:"480"})}),"\n",(0,r.jsx)(t.p,{children:"Sometimes you may want to inject JavaScript code before or after the web page is loaded in order to add, replace or remove content from the web page or to change some web page logic."}),"\n",(0,r.jsxs)(t.p,{children:["In this article, we are going to understand what User Scripts are and how we can use them to inject custom JavaScript code at a specific time inside the WebView using the ",(0,r.jsx)(t.a,{href:"https://github.com/pichillilorenzo/flutter_inappwebview",children:"flutter_inappwebview"})," plugin."]})]})}function u(e={}){let{wrapper:t}={...(0,a.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},254:function(e,t,i){i.d(t,{Z:function(){return n}});let n=i.p+"assets/images/article-banner-55de1f6922b286c4d303a6f345dd888e.webp"},65:function(e,t,i){i.d(t,{Z:function(){return o},a:function(){return s}});var n=i(7294);let r={},a=n.createContext(r);function s(e){let t=n.useContext(a);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),n.createElement(a.Provider,{value:t},e.children)}},5786:function(e){e.exports=JSON.parse('{"permalink":"/blog/webview-javascript-injection-with-user-scripts-flutter-inappwebview-6","editUrl":"https://github.com/pichillilorenzo/inappwebview.dev/tree/main/blog/webview-javascript-injection-with-user-scripts-flutter-inappwebview-6/index.md","source":"@site/blog/webview-javascript-injection-with-user-scripts-flutter-inappwebview-6/index.md","title":"Injecting JavaScript in Flutter Web View With User Scripts","description":"Learn how to leverage Flutter\'s InAppWebView 6 plugin","date":"2022-11-28T22:00:00.000Z","tags":[{"inline":true,"label":"inappwebview","permalink":"/blog/tags/inappwebview"},{"inline":true,"label":"webview","permalink":"/blog/tags/webview"},{"inline":true,"label":"user-script","permalink":"/blog/tags/user-script"},{"inline":true,"label":"user-scripts","permalink":"/blog/tags/user-scripts"},{"inline":true,"label":"javascript","permalink":"/blog/tags/javascript"}],"readingTime":5.445,"hasTruncateMarker":true,"authors":[{"name":"Lorenzo Pichilli","title":"Plugin Author","url":"https://github.com/pichillilorenzo","imageURL":"https://github.com/pichillilorenzo.png","key":"lorenzo","page":null}],"frontMatter":{"slug":"webview-javascript-injection-with-user-scripts-flutter-inappwebview-6","title":"Injecting JavaScript in Flutter Web View With User Scripts","image":"article-banner.webp","date":"2022-11-28T22:00:00.000Z","authors":["lorenzo"],"tags":["inappwebview","webview","user-script","user-scripts","javascript"]},"unlisted":false,"prevItem":{"title":"Convert a PWA Into a Flutter App Using WebViews","permalink":"/blog/convert-a-pwa-into-a-flutter-app-using-webviews"},"nextItem":{"title":"WebView Content Blockers \u2014 Flutter InAppWebView 6","permalink":"/blog/webview-content-blockers-flutter-inappwebview-6"}}')}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.