开发者

How do I stop images or flash from loading into the browser?

开发者 https://www.devze.com 2023-04-08 16:35 出处:网络
I am creating a web page that accepts a hyperlink from the user and displays that page in an iframe. While rendering the page, I would like to show just the text and simple colors, thats it.

I am creating a web page that accepts a hyperlink from the user and displays that page in an iframe. While rendering the page, I would like to show just the text and simple colors, thats it.

I would like to block all the media files like images and flash scripts from showing up.

If not an extensive one, for the starters, I would like to confine the scope to .gif, .jpeg, .jpg, .png, .swf.

Or does anyone know of a site with similar functiona开发者_JAVA技巧lity?


You can write a simple dom parser and parse the page before show it in iframe. Then before showing it you can remove whatever you want.

your iframe whould like

<iframe src="your_parser.php"></iframe>

In your parser you can get the content from page using file_get_contents() or curl() it is your choise (i would use curl). Then you can remove the media you want.


If you're using Firefox, use the Adblock Plus extension. You can specify the types of items to block via a filter rule. An example (using Safaribooks) looks like this:

||techbus.safaribooksonline.com/static/201109-2191-techbus/images/6.0/*.jpg

However, if you're talking about incorporating functionality into your page to strip out a specific list of content-types, this approach wouldn't help you. You'd need to pull the html source and strip out the offending content-types.


also if you are using cms. you should be turn off bbcode image, and embed html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号