playwright icon indicating copy to clipboard operation
playwright copied to clipboard

How to Embed Playwright Headless Browser into a website?

Open sameh81 opened this issue 6 years ago • 5 comments

Hi team, I'm using playwright to render websites in Server-side to extract the web elements such as HTML, CSS and JS and serve these elements to an iframe that is embedded into my web app, the problem is that the iFrame is causing me a lot of problems due to the fact that many websites are restricting their websites to open in iframe due to security reasons (not the same origin). I'm wondering what would be the alternative to serving these resources into the iframe? is it possible to run the complete headless browser as part of a web page without the iframe? please help!

Thanks for all your effort and great work.

Regards Sam

sameh81 avatar Aug 19 '20 01:08 sameh81

Iframe is just like a page so it should be not cause any issue. U can directly use SSR . Is there any code we can see so we can suggest it? Regarding website restricting that shouldn't be issue i think because u can always proxy them ?

shirshak55 avatar Aug 19 '20 08:08 shirshak55

Hi Shirshak, how can I reach you on Discord? do you have availability to work on a side project? I tried to look for your account in Discord "shirshak9166" but it says the account is incorrect.

sameh81 avatar Aug 20 '20 20:08 sameh81

@sameh81 sorry it is mighty_soft_tofu#9166.

shirshak55 avatar Aug 21 '20 06:08 shirshak55

is it possible to run the complete headless browser as part of a web page without the iframe?

@sameh81 this wouldn't be possible - browsers require low-level OS api's that are not available in the web platform.

I'm wondering what would be the alternative to serving these resources into the iframe?

This is probably too generic question to answer here.. And it doesn't relate to playwright. I'd recommend asking this on Stackoverflow instead.

aslushnikov avatar Aug 21 '20 08:08 aslushnikov

@shirshak55 , thanks, inhale added you to discord, looking forward to chat with you

sameh81 avatar Aug 21 '20 12:08 sameh81