Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some pages open in full screen not <Iframe> #6

Closed
jmbaravykas opened this issue Mar 19, 2017 · 5 comments · Fixed by #7
Closed

Some pages open in full screen not <Iframe> #6

jmbaravykas opened this issue Mar 19, 2017 · 5 comments · Fixed by #7

Comments

@jmbaravykas
Copy link

I'm learning your script and looking at the demo app. And noticed that some sites are being opened in full screen not iframe for example this page "http://www.delfi.lt/", which is a news page.
I'm not sure but the problem might be here

Can't Load URL: The domain of this URL isn't included in the app's domains. ping?client_id=161041023936278&domain=localhost&origin=1&redirect_uri=http%3A%2F%2Fstaticxx.faceboo…:1 To be able to load this URL, add all domains and sub-domains of your app to the App Domains field in your app settings.

OneSignal: Could not load iFrame with URL https://delfi.onesignal.com/webPushIframe. Please check that your 'subdomainName' matches that on your OneSignal Chrome platform settings. Also please check that your Site URL on your Chrome platform settings is a valid reachable URL pointing to your site.

@aivus
Copy link
Member

aivus commented Mar 19, 2017

Hello, @Holdimas.

We will fix "full screen" issue in #7.

About second issue: Looks like site has JS checks for current domain and show blank page in case of opening it from other domains.

@jmbaravykas
Copy link
Author

I see, thank you for this information. Also can I still append custom scripts and custom styling to the scraped web page in <iframe>? For instance a css selector?

@s0ph1e
Copy link
Member

s0ph1e commented Mar 20, 2017

Hi @Holdimas
Not sure that I understand what do you want to style inside iframe. Could you please describe it with more details?

@jmbaravykas
Copy link
Author

Good day @s0ph1e , it's okay I solved the styling issue with jQuery.
But what really I'm interested in, since some pages (as mentioned before) open in full screen not in iframe, due to some security reasons. Can I append some extra scripts and css stylings into parsed page? So when I open it in full (still in localhost) I would for instance have some tools (mine) on that page? This is mainly so that the user would be able to select element, and highlight them. So I kinda did that in iframe, but can I append so scripts and css to parsed page itself?

@s0ph1e
Copy link
Member

s0ph1e commented Mar 21, 2017

@Holdimas this app is only a demo for npm module website-scraper, you can't do it in this app because it just downloads pages from given url without any transformation.

But you can try to use website-scraper directly and add scripts to html-files using option httpResponseHandler
It should look like this:

scrape({
  urls: ['http://example.com/'],
  directory: '/path/to/save',
  httpResponseHandler: (response) => {
  	if (isHtml) {
		const bodyWithScripts = appendScriptsToBody(response.body);
		return Promise.resolve(bodyWithScripts);
	} else {
                return Promise.resolve(response.body);
       }
  }
});

@s0ph1e s0ph1e closed this as completed in #7 Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants