How to do I decrease font size for the content in page viewer web part in sharepoint

I'm calling a web page from page viewer web part but the content font size is big and want to make it smaller. I used below javascript in Scripteditor web part but that is not working. Below is the script

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
$('p', $('MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');//MSOPageViewerWebPart_WebPartWPQ5 is the ID property of my iframe
};
</script>
buzzme123Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
have not yet tested this, but the id selector is wrong and should be:
jQuery('p', $('#MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');

Open in new window

If this is still not working, you perhaps have to attach a event handler to the iframe load event so that the text size change is running after the iframe is loaded.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
 <script type="text/javascript">
jQuery(document).ready(function() {
  jQuery('#MSOPageViewerWebPart_WebPartWPQ3').bind('load', function() { 
  $('p', $('MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');
 });
});
 </script> 

Open in new window


Which SharePoint version and edition?
Thanks and HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
buzzme123Author Commented:
first one did not work. I'm using SharePoint 2013 version. I will try the second one.
0
buzzme123Author Commented:
Don't know why. I tried the second one and it did not work either. I'm going to try on a different page and see if that works or not.
0
buzzme123Author Commented:
By the way I'm using scripteditor webpart to have this code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.